AX / D365FO – Display Methods – Retrieve multiple Form Data Sources

I have a form with 3 datasources – CustPackingSlipJour, PurchLine, WHSLoadTable.

I have placed a display method on CustPackingSlipJour form DataSource, but I need access to one field on PurchLine.

All I can access is the CustPackingSlipJour which is passed as a parameter _custPackingSlipJour, as standard.

How can I retreve value from the second DataSource PurchLine?

Answer is simple…You can then use _custPackingSlipJour.joinChild() to retrieve the linked PurchLine, here is an example :

[DataSource]

class CustPackingSlipJour
{

public display real deltaAmount(CustPackingSlipJour _custPackingSlipJour)
{
  real ret;
  PurchLine purchLineLcl;

//This will retreve PurchLine DataSource
purchLineLcl.data(_custPackingSlipJour.joinChild());

//Here you can use the buffer
ret = purchLineLcl.LineAmount - _custPackingSlipJour.OTS010_OrPrice;

return ret;
}

}

Leave a comment