Microsoft Dynamics AX 2012: How to get Company,Customer and Vendor address in AX 2012

Scenario:  “How to get Addresses ofCustomer, 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)

Img1

Now if we want to get this specific customer address we can use the following code.

Img2

Simliar for the Vendor

Img3

Use following code:

Img4

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

So,

Img5

 

Img6

Advertisements

6 responses to “Microsoft Dynamics AX 2012: How to get Company,Customer and Vendor address in AX 2012

  1. Nice one, worked perfectly. Especially that of the company info. Can u do 4 company logo’s 2?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s