Blog

Name is Anant Dubey and the intent to create this blog is to discuss the problems and issues that developer face in the dynamics AX development and to share the new things that come up with the new version of AX.

Friday, 27 February 2015

How to track item's address in ax 2012

static void S3_TrackItemsAddress(Args _args)
{
    VendTable               vendTable;
    str                     description, address, city;
    InventTable             inventTable;
    DirPartyTable           DirPartyTableloc;
    ;

select inventTable where inventTable.ItemId == salesline.ItemId;
        select DirPartyTableloc
        join vendTable where DirPartyTableloc.Name == inventTable.PrimaryVendorId &&
             vendTable.Party == DirPartyTableloc.RecId;

        vendTable   = VendTable::find(vendTable.AccountNum);
        description = DirParty::primaryPostalAddress(vendTable.Party).displayLocationDescription();
     
        address     = DirParty::primaryPostalAddress(vendTable.Party).Address;

        city        = DirParty::primaryPostalAddress(vendTable.Party).City;

    info(strFmt("%1,%2, %3", description,city, address));
}