For this demonstration, I use AIF service to create Sales order with SalesSalesOrderService and I gonna consume AIF using C#.NET.
Normally, in consume service application we handle return value by using EntityKeyList, EntityKey, KeyData.Value. And for Sales Order It will return Created SalesID.
Let’s take a look on AxdSalesOrder class. More about Axd class please prefer this.
Then go to createList method, this method will handle response value
So, how about customer wants another meaning value beside SalesID likes InventTransId information in SalesLine table or another tables base on your requirement. To do that, we need to customize this method.
How to do
I will use Map and MapEnumerator classes (Please refer MSDN to understand these class), this is steps:
We get the SalesId from the original entityKeyList and add into Map.
add Map to MapEnumerator.
Use SalesId to find the sales line. (mapEnumerator.currentValue() can get current SalesID).
Create a new entityKey and insert the sales line information to this entityKey.
add back entityKey to entityKeyList
From here in entityKeyList will store information of SalesID and List fields of SalesLine table.
Here is the code for createList method, beside SalesId I will try to get InventTransId in SalesLine Table
Code in C#.NET to get list key
Here is what we got
Just remember this one just for AIF Document Standard, for AIF custom service we do another way I will so in next post.