Assign a phone/email to a specific customer address

Hi, I’m working in AX 2012 creating customers and their addresses in X++. I am also adding phone numbers and email addresses to the postal address, by using this code:

DirParty dirParty = new DirParty(dirPerson);

dirPartyContactInfo.LocationName = “Main email”;
dirPartyContactInfo.Locator =";
dirPartyContactInfo.Type = LogisticsElectronicAddressMethodType::Email;
dirPartyContactInfo.IsPrimary = NoYes::Yes;


It works great, however, when I add more than one address, I don’t know how to add contact information (phone, email) for those extra addresses, because these contacts that I’m currently creating remains in the “main” form:

Instead of being assigned to each addresses, which is what I need, so they appear in this area for each address:

Any idea how to assign contacts to specific addresses using X++? I would appreciate your help, thanks!

I found the solution! you just need to create a new record in the LogisticsLocation, when one of the fields (ParentLocation) is the RecId of the new address that was created, then grab the RecId of the new LogisticsLocation record, and assign it to the DirPartyContactInfoView.Location field, then call dirParty.createOrUpdateContactInfo(dirPartyContactInfo) and that will link the contact to the specific address.