In this blog, I will discuss how we can apply prepayment through X++ code.in Microsoft Dynamics 365 finance & operation.
Note: For applying the prepayment you need to have the vendor invoice, you can create manually or you can create it by X++ code Job to create vendor invoice (PO) through X++ code in D365.
For this example I have created a job, please see source code screenshots below.
Source code explanation (1.1):
- Initialize classes and tables buffers.
- Get Vendor invoice by passing purchase order and invoice number.
- Construct the VendAdvanceInvoice class.
Source code explanation (1.2):
Source code explanation (1.4):
That is all you need to do, now build and run the job.