Download NAV Objects to Get Customer and Vendor Applied Docs Easily

Here is about how to get applied documents with applied amounts related to customer’s or vendor’s documents using C/AL programming on Dynamics NAV.

I created a Codeunit to get applied documents very easily. This can use for any scenarios related to getting applied data from customers or vendors. For example, you can use this when creating invoices with applied payments reports or else.

You can download the Codeunit (fob/txt formats) using the following links.

The object ID of the Codeunit is 50000, and If you want to change the ID, download the “.txt” file and changed the ID by opening it from Notepad before import.

How to use the Codeunit?

The Codeunit has two functions as below to get applied docs from customer and vendor ledger entries.

GetAppliedCustomerDocs()
GetAppliedVendorDocs()

Each function has three parameters.

  1. The first parameter is the ledger entry that you want to get applied data.
  2. The second parameter is a temporary record (Customer/vendor Ledger Entry) to add applied documents details. All applied data will be adding to the temporary record after running the function. ***Note: Check the record of second parameter is set as temporary before running this.
  3. The third parameter is a Boolean to get the applied amount with LCY or not. If you want to get applied amounts as local currency, pass the value as TRUE for this parameter.

***Note : (Delete all data of the temporary record before getting applied data of a new document).

See the following example of calling these functions.

//Customer ledger applied data--------------------------------
TEMPAppliedCustLedgerEntry.DELETEALL;
GetAppDoc.GetAppliedCustomerDocs(CustLedgerEntry,TEMPAppliedCustLedgerEntry,TRUE);

//Vendor ledger applied data----------------------------------
TEMPAppliedVendLedgerEntry.DELETEALL;
GetAppDoc.GetAppliedVendorDocs(VendLedgerEntry,TEMPAppliedVendLedgerEntry,TRUE);Code language: PHP (php)

After calling these functions, you can get all applied documents records with ledger details of the “CustLedgerEntry” record using the “TEMPAppliedCustLedgerEntry” and “TEMPAppliedVendLedgerEntry” records. The “Amount to Apply” field of the TEMP record represents the applied amount.

Visit the previous tutorial about, how to process a URL without opening a web browser in C/AL.

Senior Solutions Architect - Microsoft Dynamics Navision / Microsoft Dynamics 365 Business Central and freelance developer. (The admin of NAVUSER)

Leave a Comment