AX / D365FO – How to get Customer delivery address in X++

To get the Customer delivery address you can use custtable.mcrDefaultDeliveryPostalAddress() method

This example shows how to get a formatted customer delivery address from a given invoice Account

LogisticsPostalAddress logisticsPostalAddress;
str deliveryAddress;                
str deliveryName;

logisticsPostalAddress = CustTable::find(custInvoiceJour.salesTable().InvoiceAccount).mcrDefaultDeliveryPostalAddress();

deliveryAddress = logisticsPostalAddress.Street + "\n" + logisticsPostalAddress .ZipCode + " - " + logisticsPostalAddress.City + (logisticsPostalAddress.CountryRegionId ? strFmt(" (%1)", logisticsPostalAddress .CountryRegionId) : "");

deliveryName = custInvoiceJour.DeliveryName;

Leave a Reply

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

You are commenting using your 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 )

Connecting to %s