web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

I want to ignore the OnNextRecord trigger for one time(when I submit the Document)

(1) ShareShare
ReportReport
Posted on by 132
Hi,
 
I have a Document page called "Expense Document" in this we have lines called "Expense Lines".
first, we need to enter the data and insert one line for the created Document.
 
When we are submitting the document the OnNextRecord trigger is executing, but I like to ignore that OnNextRecord trigger for once,
it has to word same as before for the scenarios except when we are submitting the document.
 
In submit action I wrote CurrPage.Close() it has to close the page without running the code which present in the OnNextRecord trigger.
 
Is it possible to do that.
Please suggest your thoughts on this.
I have the same question (0)
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    21,046 Super User 2025 Season 2 on at
  • Netjacker2097 Profile Picture
    286 on at
    Hi,
     
    assuming i understand you correctly:
     
    Introduced a global variable SkipOnNextRecord in the page to act as a flag:
     
    var
        SkipOnNextRecord: Boolean;

     
    In the SubmitDocument action, I set this flag to true before calling CurrPage.Close():
     
    action(SubmitDocument)
    {
        trigger OnAction()
        begin
            SkipOnNextRecord := true; // Set the flag to skip OnNextRecord code
            CurrPage.Close();
        end;
    }

     
    In the OnNextRecord trigger, I added a check for this flag. If the flag is true, the trigger code is skipped:
     
    trigger OnNextRecord(Direction: Text[1]): Boolean
    begin
        if SkipOnNextRecord then
            exit(false); // Skip the trigger code
     
        // Existing OnNextRecord code here
    end;

     
    Hope this helps.
     
    Thanks,
    M

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,798

#2
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 812 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 717 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans