x++ code to get Customer Address based on purpose in ax 2012
static void customerAddress(Args _args) { DirPartyPostalAddressView dirPartyPostalAddrlocal; DirPartyLocationRolesView dirPartyLocationRoleslocal; LogisticsLocationRole logisticsLocRole; select firstOnly * from dirPartyPostalAddrlocal order by RecId desc exists join dirPartyLocationRoleslocal where dirPartyLocationRoleslocal.Location == dirPartyPostalAddrlocal.Location && dirPartyLocationRoleslocal.Party == CustTable::find(_accountNum).Party//_dirpartyRecid //&& dirPartyPostalAddrlocal.IsPrimary == NoYes::No exists j...