Scenario: “How to get Addresses of “Customer, Vendor and Company”
1) First we need to identify which table store address of each entity
Table : LogisticsPostalAddress : In Dynamics AX 2012 this is the main table which stores every address of each entity(customer/vendor…).This table contains fields like city,country,state,zipCode etc. required for the address.
a) Customer/Vendor address
Assume that we have the customer with CustAccount = 1103 and has the address and infact which is the primary/main address.(below)
Now if we want to get this specific customer address we can use the following code.
Simliar for the Vendor
Use following code:
a) Company Address
For the Company address we can use the CompnayInfo table to get first the company and then find its address in LogisticsPostalAddress table.
We can find the LogisticsPostalAddress of the current company by Location .
This line give the location of the current company
Now get the logisticsPostalAddress reference we can use and find the address