How to display the Address based on invent siteId ?

Hi,

I am customizing the sales invoice report in AX 2012. I want to display the invent site address instead of Company address in salesinvoice report. The site addresses are stored in Logistics postal Address table. I create a new salesorder and give the site and warehouse. these site address are displayed in Company Address. Pls help me how to write the business logic of this customisation.

Thanks,

Balu

Hi,

If the site address is stored in the Logistics Postal Address Table, then do the following things:

  1. Enter a new field into SalesInvoiceTmp table. (This is the table where the data gets filled and this table in turns fills the dataset for the report).

  2. Then in the class SalesInvoiceDP, inside the method insertIntoSalesinvoiceTmp, write the following code

SalesInvoiceTmp.NewField = LosicticsPostalAddress.Address.

  1. Refresh the datset and you would see a new field.

  2. Drag this field into the designer finally at the appropriate place.

Hope it helps.

Preeti

Hi Preeti,

How to link between the Invent site Table and Logistics Postal Address.

All fields are coming from CustinvoiceJour table

1.The InventSite Table RecId and LogisticsLocation Table Recid are stored in InventSiteLogisticsLocation(siteId,LocationId these two fields are Ref Fields In this table)

  1. How to use this Ref fields and display the Address.

InventSite–>CustInvoiceJour–>InventSiteLogisticsLocation<–LogisticsLocation<–LogisticsPostalAddress

(siteId) (InventLocationId) (RefsiteId,RefLocationId) (LocationId) (RefLocationId,Address)

How to write a select query for Address

Thanks,

Balu

Hi,

I am confused with this logic.We can select different site for each Item id for one sales order.In this way what Address you will print in sales order invoice.If it is right please excuse!

Hi,

Check below path.

\Data Dictionary\Tables\LogisticsPostalAddress\Methods\findByLocationAndValidDateTime_IN

SalesInvoiceTmp.NewField = LogisticsPostalAddress::findByLocationAndValidDateTime_IN(Inventsite::find(your site id),invdate,invdate).address

Use datetobeginUtcDateTime(),datetoendUtcDateTime for converting date to datetime.

Hope this will solve your problem.

Hi Saju,

We select Diff sites for different salesorders. These site addresses are printed in SalesInvoice Report Header(instead of Company Address).

Thanks,

Balu

Hi,

In LogisticspostalAddress, FindByLocationAndValidDaterTime_IN method is not there.

Thanks,

Balu

hi,

Please give me a suggestion, It is very urgent Requirement.

Thanks,

Balu

I used view LogisticsEntityPostalAddressView.

inventSite = purchLine.inventDim().InventSite();

select firstOnly siteAddress
where siteAddress.EntityType == LogisticsLocationEntityType::Site
&& siteAddress.Entity == inventSite.RecId;

Late but it might help the next person…