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, LineNo) then 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;
  • Suggested answer
    Stefano Demiliani Profile Picture
    37,172 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,172 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 671 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 434 Super User 2026 Season 2

#3
Teagen Boll Profile Picture

Teagen Boll 241 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans