Friday, September 05, 2014

How To Get Contact Information on Dynamic AX 2012 R3 - Dwipa Rachmawan

Here is the sample how to get or retrieve multiple contact information on customer
like the following pictures :
When we are clicked the button More options - Advanced :

As you can see in this form the datasources is LogisticsElectronicAddress
but the information about Purpose is not in here.

So this is the jobs for retrieve contact information and display the value Purpose
static void DPR_ContactInformation(Args _args){    DirPartyContactInfoView                 contactInfoView;    LogisticsElectronicAddress              logisticsElectronicAddress;    LogisticsElectronicAddressRole          logisticsElectronicAddressRole;    LogisticsLocationRole                   logisticsLocationRole;    CustTable                               custTable;    DirPartyPostalAddressView               DirPartyPostalAddressView,postalAddressView;    select * from CustTable        where custTable.AccountNum == '3003';    while select contactInfoView        where contactInfoView.Party == custtable.Party    join DirPartyPostalAddressView        where DirPartyPostalAddressView.Party == contactInfoView.Party    join logisticsElectronicAddressRole        where logisticsElectronicAddressRole.ElectronicAddress == contactInfoView.RecId    {        info(strFmt('Name=%1 Type=%2 Locator=%3 Purpose=%4',contactInfoView.LocationName, contactInfoView.Type, contactInfoView.Locator, LogisticsLocationRole::findRec(logisticsElectronicAddressRole.LocationRole).Name));    }}
And here is the result

Good Luck
Wasalam
READ MORE - How To Get Contact Information on Dynamic AX 2012 R3 - Dwipa Rachmawan