2013-09-25

Modifying Intercompany in Dynamics AX 4.0

We have in our solution added a few new fields on the sales and purchase order for transport management. Obviously we need to include these fields in the intercompany functionality. It can be somewhat a daunting task to find exactly where in the application you need to go to find the right methods for this.
 
Example:
You have a new field on the sales and purchase order called TransportCode, you need to include this field in the IC functionality, and here is how you do it.

First add a new “parm” method in the AXSalesTable class, something like this:
 
public str parm_TransportCode(str _transportCode = "")
{;
    _transportCode = Some code to find and set the value;

    return _transportCode;
}

 
Note! The parm methods must have a name that starts with “parm”

Second add the same “parm” method in the AXPurchTable class.
 
Third, update the InterCompanyMirror method on the SalesTableType class
Like so:
axPurchTable.parm_TransportCode(salesTable.TransportCode);

 
Do the same on the PurchTableType IntercomapnyMirror
This time adjust to the parm method you wrote on the AxSalesTable class.
 
Do make sure this also takes affect when users manually change the value on one or the other side of the IC relation you need also to incude the field in the InterCompanyUpdateNow methods found on SalesTable and PurchTable tables. Like so:
this.orig().TransportCode != this. TransportCode    
Under the if statement. This will act as a trigger when a user changes a value. 
 



Object

Method

AxSalesTable

New parm method

AxPurchTable

New parm method

SalesTableType

InterCompanyMirror

PurchTableType

InterCompanyMirror

PurchTable (table)

InterCompanyUpdateNow

SalesTable (table)

InterCompanyUpdateNow

If you only need to update to work in one direction you only need to make the changes on one side of the relation.

 
 

 

Inga kommentarer:

Skicka en kommentar