In this blog I will illustrate how we can generate product receipts for purchase orders through X++ in Microsoft Dynamics 365 by less and effective code.
So lets get started, In this blog I have used 3 methods which have segregated operations and on the main method of the job I have called the method as shown below.
First Method:
In this method I have done following things:
1- Initialize a List object that hold my purchase order lines which I will used on generating the product receipts.
2- Get Purchase order line buffer, In your case you can get the buffer as you like.
3- Ignore SLD_WorkProgressAndIPCConstants class, It is my custom class that have constants values.
4- I have called modifedField method, This method will update relevant fields also this is a OOTB method.
5- In the end I have return the List.
Second Method:
In this method I have done following things:
1- Initialize PurchFormLetter class through which Product Receipt generate.
2- Get Purchase order buffer to pass in Update method in PurchFormLetter class.
3- Call PurchFormLetter class methods as shown below.
4- Update method of PurchFormLetter class will do the rest also will check all the validations so if there is any
errors it will through it.
Third Method:
In this method I have done following things:
1- In this method I simply call above methods also passing the relevant values.
Main Method:
In this method I have done following things:
1- In this method I have initialized and declare my class instance in which above three methods are written.
2- Call Process method of my class that will generate product receipt.
I hope you guys find this blog useful. If you have any question do comment it, I will try to assist you as soon as possible. That is all folks. Cheers!
No comments:
Post a Comment