Search code examples
axaptadynamics-ax-2012

Call OrigCountryRegionId from InventTable


I am trying to retrieve the value of field ShortName from the table LogisticsAddressCountryRegionTranslation based on the OrigCountryRegionId and the LanguageID fields, the LanguageId is retrieved from the CustPackingSlipJour.

I am having troubles to retrieve the OrigCountryRegionId from the InventTable.

The method InventTable exists on the table CustPackingSlipTrans, so i want to retrieve the value of the field OrigCountryRegionId on the ItemId, which is returned on the InventTable method on the CustPackingSlipTrans table.

I have a piece of code, but not sure how to implement the solution as described above.

salesPackingSlipTmp.OrigCountryRegionName = LogisticsAddressCountryRegionTranslation::find(CustPackingSlipTrans*I am lost here*, CustPackingSlipJour.LanguageId, false).ShortName;

Solution

  • The inventTable method returns an InventTable buffer so you can just retrieve the fields like this:

    CustPackingSlipTrans.inventTable().fieldName
    

    So your code would look like:

    salesPackingSlipTmp.OrigCountryRegionName = LogisticsAddressCountryRegionTranslation::find(CustPackingSlipTrans.inventTable().OrigCountryRegionId, CustPackingSlipJour.LanguageId, false).ShortName;