Dynamics AX Blog - Posts from Mai 2015
These posts are machine-translated.
How to create a AX<Table>-Class IIIf you need a so called AX-class can use the class AxGenerateAxBCClass.
Simply call this class in the AOT by right clicking and follow the wizard or use following job: static void generateAXTableClass(Args _args) { AxGenerateAxBCClass axGenerateAxBCClass; axGenerateAxBCClass = new AxGenerateAxBCClass(); axGenerateAxBCClass.parmTableId(tableNum(MyNewTable)); axGenerateAxBCClass.run(); }
If the table changes, for example when adding new fields, you simply call that AxGenerateAxBCClass again and the AX -class will be extended accordingly.
How to use such AX -classes, i've described here.
|
Add contact information for entityHere is an example of how you can add contact information data to an existing entry in the global address book. static void createPartyContactInfo(Args _args) { DirPartyTable dirPartyTable = DirPartyTable::findByNum(??"100000"); DirParty dirParty; DirPartyContactInfoView dirPartyContactInfoView; // Edit Global address book dirParty = DirParty::constructFromCommon(dirPartyTable, DirUtility::getCurrentDateTime(), DirPartyType::Organization); // Create contact info dirPartyContactInfoView.LocationName ='Office'; dirPartyContactInfoView.Locator ='+43 1 4654646'; dirPartyContactInfoView.Type = LogisticsElectronicAddressMethodType::Phone; dirPartyContactInfoView.IsPrimary = NoYes::Yes; dirParty.createOrUpdateContactInfo(dirPartyContactInfoView); } Such a created entry will look like this: |
|
|
|
|
|
|
A simple example of how to create a purchase order line through code using AX<Table>-Class.