Jigsaw Blog

29

Apr
2015
0 comments

Source Code must have a value in Gen. Journal Line

Error posting Customer opening balances generated by “Create Customer Journal Lines” report:

This error occurs under the following conditions:

  1. Running the “Create Customer Journal Lines” report to create a journal for customer opening balances
    Balances are populated directly in the Journal Line Amount field
    The Journal is posted

Under these conditions, the “SetupNewLine” function on the Gen. Journal Line table is not triggered to populate the Source Code. The report itself doesn’t default it either, so the above error will occur on posting.

There are several options to solve this problem:

  1. Copy the journal out to Excel, delete the journal, enter the balances in Excel and paste back into NAV
  2. Setup a “Standard Journal” with a blank line suiting your needs, and specify this when running the report
  3. Modify the report to pull the Source Code from the Journal Template (source below).

The first two options should suit most scenarios, but, where they can’t be used the following minor code change can be added to the report to populate the Source Code as required:

 

New Function “GetSoureCode” created to lookup the General Journal Template used, and return the Source Code.

 

In the Customer – OnAfterGetRecord() trigger, in the section of code run if “GetStandardJournalLine” returns FALSE, enter a line to validate the Source Code using the new function created.