Tuesday, June 4, 2013

AIF, execute business logic when all the records in XML are inserted.

While working with Dynamics AX 2012 AIF services. Sometimes, you need to perform some operation once all the records in the XML file are inserted in the table.

For example, let's say you call Sales order service to create 10 Sales order and passed one xml file having 10 sales orders and then you need to perform some operation like posting each sales order ONLY when all the sales order are created. To achieve this, you need to override the createList() method on Axd<Table> class and then you can perform your operations in that method by iterating all the records passed in the xml file.

To see this running, please see the AxdSalesOrder class that implements such functionality.