Get Customer, Vendor& Company Addresses in AX 2012

 Get Customer,  Vendor& Company Addresses in AX 2012

//Get Customer/Vendor Address by Id & Current Comapny Address
//By replacing the CustTable with the VendTable we will get the address of Vendor
static void Job85(Args _args)
{
    CustTable custTable;
    str       description,address,completeaddress;
    
    custTable = CustTable::find('L0115');
          
    description = DirParty::primaryPostalAddress(custTable.Party).displayLocationDescription();
    
    address = DirParty::primaryPostalAddress(custTable.Party).Address;
    
    completeaddress = strFmt("%1,%2",description,address);
    info(strFmt("%1",completeaddress));
    
    //Get the Current Company Address
    info(strFmt("%1,%2",curext(),LogisticsPostalAddress::findByLocation(CompanyInfo::find().postalAddress().Location).Address));
    
}

Leave a comment