Wednesday 22 June 2022

How to Extend Purchase Order Update Functionality to Purchase lines in D365

 To extend header field updates to line level is to use extensions and delegates in D365.  

Scenario : DlvMode field from PurchTable should be carried and updated to PurchLine.DlvMode field.

Extend the data model

Extend Purchline table in customized model and add DlvMode field to the extension table .


Add DlvMode field to PurchTable fieldGroup HeaderToLineUpdate



Prepare the update-order-lines dialog

The dialog to choose if and which fields need to be updates at the lines is generated automatically based on the HeaderToLineUpdate field group. There is some code needed to show the fields name in the dialog. This is done by subscribing a custom method to the delegate PurchTable2LineField.getFieldDescriptionDelegate.




Create a new class with below code


Extend the framework classes

Create an extension for the AxPurchLinee class and add the below code :



Build your code .

Open the Header to Line update dialog by clicking on Procurement and Sourcing > Setup > Procurement and Sourcing  parameters > General update > update order lines button 



Done!! Go ahead and test your code.

Change value for DlvMode in Purchase order header update Order lines dialog will open as below. Enable "Update Delivery mode", and select "Update all" and click OK.The DlvMode value from header will get updated at line level DlvMode value.




Happy Coding!!!!


Thanks & Regards

Sindhu