cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to get the Sales Order External ID using odata API

0 Likes
2,151

Hello,

Is it possible to get the Sales Order External ID using the C4C odata API?

I noticed that this is not exposed on the standard c4codataapi service.

I also tried to create a custom odata and expose the field from there, but I couldn't find it there either.

Best regards,

Michel Fernandes

Accepted Solutions (1)

Accepted Solutions (1)

former_member226
Employee
Employee

Hi,

You can get the external ID of the sales order using odata API as follow:

1. Pass the order ID as filter to odata API and get Order entity URL:

https://my3XXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/CustomerOrderCollection?$filter=ID eq '9000000583'

2. Get Order UUID and form the following URL:

https://my3XXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/CustomerOrderCollection('<UUID>')

This should give your order's root node.

3. Using the URL from step 2, Navigate to "CustomerOrderBusinessTransactionDocumentReference" navigation property and filter for TypeCode as 2059 (Sales Order) and BusinessSystemID as Instance ID in Communication System for whom you try to fetch external ID.

https://my3XXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/CustomerOrderCollection('00163E7842081EEA91E40792C56B2C25')/CustomerOrderBusinessTransactionDocumentReference?$filter=(TypeCode eq '2059' and BusinessSystemID eq 'CDA_HE4')

Here CDA_HE4 is instance ID as shown:

communication-system.png

From the response of this odata call you will get "ID" as the external system order ID.

Thanks

Saurabh

0 Likes

Hi Saurabh,

Thanks for the quick response.

I did not know of such node available in odata. But the problem for us is that all we have from the sales order is the external ID, so we need to find a sales order filtering by the external ID.

I tried a similar approach from your answer using the following url:
https://my3XXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/CustomerOrderBusinessTransactionDocum... eq '2059' and ID eq '2028481340')

But apparently the ID property is not filterable or searchable.

Do you have any ideas on how we could search a quote using the external id in this case?

Best regards,

Michel Fernandes

former_member226
Employee
Employee
0 Likes

Hello,

Since "ID" is not filterable in "CustomerOrderBusinessTransactionDocumentReferenceCollection" entity set hence you definitely can't filter the data just based on sales order external ID using standard offering.

however, you can give a try using a custom solution as follow:

1. Create an extension field for CustomerQuote BO OR via KUT.

2. Using Odata Extention (for SDK) or Using "Services" tab (in KUT), extend the field usage for c4codataapi.

3. Fill the field created with the Sales Order External ID using AfterModify or BeforeSave script in SDK.

4. Now your field should be filterable using external ID in odata API. Hence you should be able to filter the data based on following URL:

https://my3XXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/CustomerOrderBusinessTransactionDocum... eq '2059' and ZZ_ExtID_SDK eq '2028481340')

0 Likes

Yes, I suppose this is the only way of achieving this then.

Thank you Saurabh.

Answers (0)