Tuesday 18 October 2016

AIF Part 2- Create document service with logistics postal address and contact information

There is a common requirement of adding the address and contact information to a new entity or document in AX. Here I am explaining an example for the Student entity.

I created a custom table called as Student and need to associate address and contact information to this table aa per the global address book.

In this post I will demonstrate how to use AIF framework for handling the address part for a custom entity.

Step1: Create a student table. Add foreign key relation to DirPartytable.

Step2: Create a query AxStudent. We need to add DirPartyPostalAddressView and DirPartyContactInfoView to our query for handling address related scenarios. Add data sources as shown below.

Also set the join property as per the required scenarios, in my case I have joined all the data sources with outer join.

Set the update property to yes if the update operation is needed to be performed through AIF.

Step3: Go to Tools --> Application integration framework --> Create document service

Step4: Select the query which we have created. In my case it is AxStudent and follow the steps as shown in below screen shot.


Note: Service operations are selected as per the requirement. In my demo I will demonstrate CRUD operations. To perform update we need to include find, read and update operations. I will demonstrate the use of each operation and the difference in my upcoming posts.


This step will generate the service classes for performing the AIF operations. All the related classes will be found under below path.
Go to --> Projects -->Private Projects --> AxdAxStudent(In my case)

Step5: Move the above project to shared node and compile the project. Delete all the cache methods and to-do statements. again compile your project, your project should be error free before proceeding ahead.

Step6: Go-to the AxdAxStudent project under the classes find the Axd class generated by framework. In my case name of the Axd class is AxdAxStudent. Navigate to prepareforSaveExtended method.

Find the below section under this method.



Replace the above mentioned code with exactly as mentioned in below image.

Step7: Guess what your entity is ready to be linked with standard global address book using party type address. You now just need to perform the steps to deploy the service and test it.

In my next post I will demonstrate how to test this service using C# code from visual studio.

No comments:

Post a Comment