X++ code to retrieve contact information on customer Address in AX2012
Chaitanya Golla
17,225
Hi,
Below code helps us to retrieve the various types of contact information specified on customer address.
Contact Information on Customer:
static void CG_CustomerContOnAddress(Args _args) { CustTable custTable; DirPartyTable dirPartyTable; LogisticsLocation parentLocation, childLocation; DirPartyLocation dirPartyLocation; LogisticsElectronicAddress electronicAddress; LogisticsPostalAddress postalAddress; while select custTable where custTable.AccountNum == "XYZ" //Specify customer account join dirPartyLocation where dirPartyLocation.Party == custTable.Party join parentLocation where dirPartyLocation.Location == parentLocation.RecId join postalAddress where postalAddress.Location == parentLocation.RecId join childLocation where childLocation.ParentLocation == parentLocation.RecId join electronicAddress where electronicAddress.Location == childLocation.RecId //&& electronicAddress.Type == LogisticsElectronicAddressMethodType::Phone //Type Phone { info(strFmt("Customer: %1, PostalAddress: %2, RoleType: %3, contact description: %4", custTable.AccountNum, parentLocation.Description, electronicAddress.Type, electronicAddress.Description)); } }
Output:
Regards,
Chaitanya Golla
*This post is locked for comments