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...
Answered

Updating a field after selecting record from another page

(0) ShareShare
ReportReport
Posted on by 90

Hi,

I have a custom field "Comments" which is added in Posted Sales Shpt. Subform. I managed to code in AL that when field has value and it was clicked, it will open up the record and then it can be modified like the image:

2043.PNG

0741.PNG

So, what i wanted to achieve it that when there is no value in the field, and it is clicked, it will open up and display the list of records. I managed to display the list using the trigger OnDrillDown(), but i dont know how to set the "Comments" field when a record is selected and the button OK is clicked.

 

7558.PNG

5466.PNG

 

I am new to this AL but here is my OnDrillDown() trigger:

trigger OnDrillDown()
                var
                    CommentRec: Record "Extended Comment";
                    CommentList: Page "Extended Comment List";
                    CommentPage: Page "Extended Comment Page";
                begin
                    if Rec."Comments" <> '' then begin
                        CommentRec.SetFilter(Code, Rec."Comments");
                        CommentPage.GetRecord(CommentRec);
                        CommentPage.LookupMode(true);
                        if CommentPage.RunModal() = Action::LookupOK then
                            CommentPage.SaveRecord();
                    end else begin
                        CommentRec.SetRange(Code);
                        CommentList.GetRecord(CommentRec);
                        CommentList.LookupMode(true);
                        if CommentList.RunModal() = Action::OK then
                       // I dont know what codes will I add here
                    end;
                end;
 
  • Verified answer
    Mohana Yadav Profile Picture
    61,260 Super User 2026 Season 2 on at

    try below code in your else statement

                           CommentRec.SetRange(Code);

                           CommentList.LookupMode(true);

                           if CommentList.RunModal() = Action::OK then begin

                                CommentList.GetRecord(CommentRec);

                                 Rec.validate(Comments,CommentRec.Code);

                           end;

  • Suggested answer
    Lino Asmolo Jr Profile Picture
    90 on at

    Thanks. this solves my problem.

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 677 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 430 Super User 2026 Season 2

#3
Teagen Boll Profile Picture

Teagen Boll 280 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans