Code to find Electronic addresses from Postal Address AX 2012

Hi Folks,

Here I present the code to find the Electronic Addresses (Email / Phone / Mobile) of a Party using Logistics Postal Address framework in AX 2012.

static void FindEmailFromAddress(Args _args)



{

DirPartyTable dirPartyTable;

LogisticsPostalAddress postalAddress;

LogisticsElectronicAddress electronicAddress;

LogisticsLocation logLocation;
 
dirPartyTable = DirPartyTable::findByNum('000003452');



postalAddress = DirParty::findPostalAddressByRole(dirPartyTable.RecId, LogisticsLocationRoleType::Consignment_IN);

 
select logLocation where logLocation.ParentLocation == postalAddress.Location;

  
while select electronicAddress

where electronicAddress.Location == logLocation.RecId



{

info(electronicAddress.Locator);

}

}
 

Happy DAXing..
:)

Comments

Popular posts from this blog

Invoicing multiple Sales order using code in AX 2012

Reciprocal exchange rate in same legal entity

External Code unique value limitation D365FO