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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

Issue regarding RunModal

(0) ShareShare
ReportReport
Posted on by 700

Hi Everyone,

My issue is regarding the RunModal method which I am using on a customized page.

I have written the following code on OnAction trigger of a button. Expectation is that, upon clicking 'YES' on the confirmation dialog box a page with some filters should get opened.

But in my case, when I hit the button for the first time, incorrect page is getting opened (the page on which I am currently) then I close the page and reopen it, this time correct page is there.

I am not able to figure out the reason behind this. Kindly provide me a quick solution to this !

Many Thanks...

code snippet-

                            if IsInProgress then begin
                       
                            if Confirm('Another task is in progress Timesheet no. %1, date %2, Line no. %3', true, TimeSheetNo, periodStart, LineNothen begin
                                T_Tracker_Rec.Reset();
                                Clear(T_Tracker_Rec);
                   
                                T_Tracker_Rec.SetRange("Job No.", "Job No.");
                                T_Tracker_Rec.SetRange("Time Sheet No.", TimeSheetNo);
                                T_Tracker_Rec.SetRange("Line No.", LineNo);
                                T_Tracker_Rec.SetRange(TimeSheetDate, periodStart);
                                T_Tracker_Rec.SetRange(FieldID, ColumnID);
                                if T_Tracker_Rec.FindFirst() then begin
                                    TimeTrackerPage.SetTableView(T_Tracker_Rec);
                                    TimeTrackerPage.SetRecord(T_Tracker_Rec);
                                    if TimeTrackerPage.RunModal() Action::LookupOK then begin
                                        TimeTrackerPage.GetRecord(T_Tracker_Rec);
                                    end;                             
                                end;
I have the same question (0)
  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    Code is not so clear. Are you doing a lookup? If so, this should work:

    T_Tracker_Rec.SetRange("Job No.", "Job No.");

    T_Tracker_Rec.SetRange("Time Sheet No.", TimeSheetNo);

    T_Tracker_Rec.SetRange("Line No.", LineNo);

    T_Tracker_Rec.SetRange(TimeSheetDate, periodStart);

    T_Tracker_Rec.SetRange(FieldID, ColumnID);

    TimeTrackerPage.SetTableView(T_Tracker_Rec);

    if TimeTrackerPage.RunModal() = Action::LookupOK then begin

    TimeTrackerPage.GetRecord(T_Tracker_Rec);

    end;                            

    end;

  • Dynamics 365 Business Central Profile Picture
    700 on at

    Not lookup, it is written on the onaction trigger of a button..

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    But what do you want to do? Here you're opening a page in a lookup mode.

    To open the TimeTrackerPage page by passing the filtered records (T_Tracker_Rec variable), you can do simply:

    T_Tracker_Rec.SetRange("Job No.", "Job No.");

    T_Tracker_Rec.SetRange("Time Sheet No.", TimeSheetNo);

    T_Tracker_Rec.SetRange("Line No.", LineNo);

    T_Tracker_Rec.SetRange(TimeSheetDate, periodStart);

    T_Tracker_Rec.SetRange(FieldID, ColumnID);

    TimeTrackerPage.SetTableView(T_Tracker_Rec);

    TimeTrackerPage.RunModal()

  • Dynamics 365 Business Central Profile Picture
    700 on at

    Still facing the same issue..For the first time, the page from which I am hitting the button is getting opened and when I repeat the process second time, it navigates me to the correct page..

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

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,857 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,047 Super User 2026 Season 1

#3
Dhiren Nagar Profile Picture

Dhiren Nagar 959 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans