How to create a error message on post action of journal voucher(16571) if line narration and voucher narration are empty

How to create a error message on post action of journal voucher(16571) if line narration and voucher narration are empty.

Hi,

You need to create a function and check for all lines having records in “Gen. Journal Narration” Table or not.

Give it a try and let us know what you tired.

Tip - ** Primary key of “Gen. Journal Line” is a part of key of “Gen. Journal Narration” and try to zoom the voucher narration record and see how you can link them…

Hi,
i have tried with the following code but it is not working properly , it is always throwing error for first line in journal voucher (p-16571).

“Gen Journal Narration”.RESET;
IF “Gen Journal Narration”.Narration= ‘’ THEN BEGIN
REPEAT
SETRANGE(“Document No.”);
“Gen Journal Narration”.SETRANGE(“Gen Journal Narration”.Narration);
“Gen Journal Narration”.FINDFIRST;
UNTIL NEXT = 0;
ERROR(‘Verify that Line Narration and Voucher Narration fields are entered’);
END;

Hi,
Think about setrange of Template and batch no.
For Voucher narration - Gen. Journal Line No. should be = 0.
For Line Narration - Gen. Journal Line No. should be = Line No of the record line.

have you solve these?

Hi,
Yes this issue has been resolved. Check the “Verified answer” above. [:)]

write these code in action no 50

Gnarration.RESET;
Gnarration.SETRANGE(“Journal Batch Name”,“Journal Batch Name”);
Gnarration.SETRANGE(“Document No.”,“Document No.”);
IF Gnarration.FINDFIRST THEN REPEAT
IF (Gnarration.“Gen. Journal Line No.” = 0) AND (Gnarration.Narration = ‘’) THEN
ERROR(‘Voucher Narration is blank.’);
IF (Gnarration.“Gen. Journal Line No.” <> 0) AND (Gnarration.Narration = ‘’) THEN
ERROR(‘Line Narration is blank.’);
CODEUNIT.RUN(CODEUNIT::“Gen. Jnl.-Post”,Rec);
CurrentJnlBatchName := GETRANGEMAX(“Journal Batch Name”);
CurrPage.UPDATE(FALSE);
UNTIL Gnarration.NEXT = 0
ELSE IF NOT Gnarration.FINDFIRST THEN
ERROR(‘No Voucher or Line Narration is there for this Document No.’)