How do you avoid the missing description error when Omit Default Description is ticked?

EwanScott
Member Posts: 2
We are using Nav 2017.
I have C/AL code to calculate intercompany and do various other things.
Code Snippet
GenJnlLine.INIT;
EVALUATE(GenJnlLine."Posting Date", GetFieldStr('PostingDate'));
GenJnlLine."Journal Template Name" :='GENERAL';
GenJnlLine."Journal Batch Name" := 'INTERCO';
GenJnlLine."Posting No. Series" := 'INTERCO';
GenJnlLine."Document Type" := 0;
GenJnlLine."Document No." := DocNo;
GenJnlLine."External Document No." := '';
GenJnlLine."Account Type" := GenJnlLine."Account Type"::"G/L Account";
GenJnlLine.VALIDATE("Account No.", GetFieldStr('AccountNo'));
EVALUATE(Amt, GetFieldStr('Amount'));
GenJnlLine.VALIDATE(Amount, Amt);
GenJnlLine.Description := GetFieldStr('Descr');
GenJnlLine.VALIDATE("Shortcut Dimension 1 Code", GetFieldStr('COSTCENTRE'));
However when Omit Default Descr. in Jnl. is ticked against an account in chart of accounts I get a missing Description error. I have tried setting the description before setting the account without success.


How do I change my code to avoid this error?
I have C/AL code to calculate intercompany and do various other things.
Code Snippet
GenJnlLine.INIT;
EVALUATE(GenJnlLine."Posting Date", GetFieldStr('PostingDate'));
GenJnlLine."Journal Template Name" :='GENERAL';
GenJnlLine."Journal Batch Name" := 'INTERCO';
GenJnlLine."Posting No. Series" := 'INTERCO';
GenJnlLine."Document Type" := 0;
GenJnlLine."Document No." := DocNo;
GenJnlLine."External Document No." := '';
GenJnlLine."Account Type" := GenJnlLine."Account Type"::"G/L Account";
GenJnlLine.VALIDATE("Account No.", GetFieldStr('AccountNo'));
EVALUATE(Amt, GetFieldStr('Amount'));
GenJnlLine.VALIDATE(Amount, Amt);
GenJnlLine.Description := GetFieldStr('Descr');
GenJnlLine.VALIDATE("Shortcut Dimension 1 Code", GetFieldStr('COSTCENTRE'));
However when Omit Default Descr. in Jnl. is ticked against an account in chart of accounts I get a missing Description error. I have tried setting the description before setting the account without success.


How do I change my code to avoid this error?
0
Answers
-
You must make sure
GenJnlLine.Description
is not empty when using this option. EitherGetFieldStr('Descr')
returns an empty string, or the field is cleared later by some code.0 -
Fact is the field is not cleared as the description is present if nominals with this option set are not in the journal. I have also checked the source and no descriptions are empty0
-
Well, the error is triggered in Codeunit 22 procedure CheckDescriptionForGL when the Description in the GenJnlLine is empty. Only there, at least in BC24. If deferral is involved, the Description field checked might be on the Deferral Line or the Deferral Posting Buffer, rather than the Gen. Journal Line.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions