Home > X++ stuffs > AIF Update in Dynamics Ax

AIF Update in Dynamics Ax

 

Hi all,

Yesterday night I was going through the site "Discussion in Axapta Programming.” There was a question regarding AIF (Application Integration Framework).


The possibility to do updates of documents using AIF was introduced in SP2 (AX 4.0).

Let me explain you in detail
Suppose I want to use the AxdSalesOrder document to create new Sales Table entries and also to update existing sales Order, then ‘update’ action is used.

 

How to perform update operation on AxD:

 

v        Make sure that Axd<Table name> supports ‘update’ functionality.

v        Configure AIF to update <AxD> in the system. [Refer Configuring AIF]

v        Send (or) Create a valid transformed XML, so that the same could be used to ‘update’.

v Update any field value in the XML (i.e. <CustAccount>).

 

 <?xml version="1.0" encoding="utf-8" ?>
<Header>
  <MessageId>{FFF3E75E-A75C-4228-ABF0-8E3EA2483EE6}</MessageId>
  <SourceEndpointUser>Domain\UserName</SourceEndpointUser>
  <SourceEndpoint>EPDMO</SourceEndpoint>
  <DestinationEndpoint>LEDMO</DestinationEndpoint>
  <Action>createSalesOrder</Action>
  </Header>
<Body>
  <DocPurpose>Original</DocPurpose>
  <SenderId>dmo</SenderId>
<SalesTable class="entity">
  <CurrencyCode>USD</CurrencyCode>
<!– Update Field –>
  <CustAccount>4004</CustAccount>
  <CustGroup>20</CustGroup>
  <DeliveryDate>2008-06-28</DeliveryDate>
  <InvoiceAccount>4014</InvoiceAccount>
  <LanguageId>en-us</LanguageId>
  <PurchOrderFormNum>Client PO Identifier</PurchOrderFormNum>
  <SalesID>00018_036</SalesID>
  <ShippingDateRequested>2008-05-01</ShippingDateRequested>
<SalesLine class="entity">
  <ItemId>B-R14</ItemId>
  <SalesQty>151</SalesQty>
  <SalesUnit>Pcs</SalesUnit>
  </SalesLine>
  </SalesTable>
  </SalesOrder>
  </Body>
  </Envelope>
v Now make sure you override "allowUpdateUsingCreate" method to return ‘true’  on the AxD Class.

protected boolean allowUpdateUsingCreate()
{
               return true;

}

v Set ‘update’ to ‘Yes’ in our Axd<Table name> Query as shown below.

 img239/2724/64121747of7.jpg

 

Note : Update should be set to ‘Yes’ for all the child datasource which are used in Axd query.

 

Run the Inbound job and records will be updated as required.

static void InboundProcessing(Args _args)

{

     ;

     new AifGatewayReceiveService().run();

     new AifInboundProcessingService().run();

}

 

Now ‘updating’ any records in AX is easierSmile

Advertisements
Categories: X++ stuffs
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: