how to stop post in bank receipt voucher if line and voucher narration is blank?

Atmadeep
Member Posts: 1
I want to give an error message when trying to post if either line and voucher narration is blank
till now I have written this code by which if either of the narration is present then it is posting (GenJr is the record variable of table for line narration and voucher narration page as both of them go to same table)
GenJr.RESET;
IF GenJr.FINDSET THEN REPEAT
GenJr.SETRANGE(GenJr."Journal Template Name","Journal Template Name");
GenJr.SETRANGE(GenJr."Journal Batch Name" ,"Journal Batch Name");
//GenJr.SETRANGE(GenJr."Gen. Journal Line No.","Line No.");
CODEUNIT.RUN(CODEUNIT::"Gen. Jnl.-Post",Rec);
CurrentJnlBatchName := GETRANGEMAX("Journal Batch Name");
CurrPage.UPDATE(FALSE)
UNTIL NEXT=0
ELSE ERROR('A');
is there any way I can access line narration page narration field in bank payment voucher page?
till now I have written this code by which if either of the narration is present then it is posting (GenJr is the record variable of table for line narration and voucher narration page as both of them go to same table)
GenJr.RESET;
IF GenJr.FINDSET THEN REPEAT
GenJr.SETRANGE(GenJr."Journal Template Name","Journal Template Name");
GenJr.SETRANGE(GenJr."Journal Batch Name" ,"Journal Batch Name");
//GenJr.SETRANGE(GenJr."Gen. Journal Line No.","Line No.");
CODEUNIT.RUN(CODEUNIT::"Gen. Jnl.-Post",Rec);
CurrentJnlBatchName := GETRANGEMAX("Journal Batch Name");
CurrPage.UPDATE(FALSE)
UNTIL NEXT=0
ELSE ERROR('A');
is there any way I can access line narration page narration field in bank payment voucher page?
0
Answers
-
Hello,
Can you explain a bit more, I don't see in your question what you mean by Voucher Line and Voucher Narration and their relation. (and I cannot find those in my database).
What I do know is that you should SETRANGE first and then use FINDSET.
And if you do [GenJr.FINDSET THEN REPEAT] then you should do [UNTIL GenJr.NEXT=0].
And you can not access fields in another Page. (that is what I know.)
And this is the classic client section
Good luck.\\The truth exists in seven versions.0 -
Hey Atmadeep,
I believe the first thing needed is to rearrange the codes. After Reset of the Record variable you need to do SETRANGE then FINDSET is written. In codeunit.Run you are passing Rec as parameter but I think you need to pass Genjr.Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/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