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!

Matt

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

http://msdn.microsoft.com/en-US/library/aa643886(v=ax.50)

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

Hope this helps

Bob

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