How are the Address table and CustTable connected?

I would like to find the primary address based on a CustTable record. How can I accomplish this? What is the connection between the address and the CustTable? Thanks in advance!


For AX2009:

Using the PartyId from CustTable, find the record in DirPartyTable. Using the RecId from DirPartyTable, find it in the AddrRecId where AddrTableId is 2303.

Here is what MSDN says the table relation is between Address and CustTable:

Address.AddrRecId == CustTable.RecId

Address.AddrTableId == CustTable.TableId

There can be several “Primary” addresses associated to a Customer. Primary is set in DirPartyAddressRelationship.IsPrimary

Hope this helps


Would you be able to provide an x++ example of this for me please?

Thanks for the replies! I ended up using Bob’s info and then finding DirPartyAddressRelationship.IsPrimary based on the following relationships:

Address.RecId == DirPartyAddressRelationshipMapping.AddressRecId

DirPartyAddressRelationshipMapping.PartyAddressRelationshipRecId == DirPartyAddressRelationship.RecId