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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

GetSelectionFilter() Alternative

(5) ShareShare
ReportReport
Posted on by 460
Hello Mentors
 
What is the work around or alternative to GetSelectionFilter() whenever it is not available for some list Page.
 
I tried below but not working.
 
field(VendorPostingGroup; VendorPostingGroup)
                    {
                        Caption = 'Vendor Posting Group';
                        ToolTip = 'Select the vendor posting group for the report.';
                        LookupPageId = "Vendor Posting Groups";
                        trigger OnLookup(var Text: Text): Boolean
                        var
                            LookupPage: Page "Vendor Posting Groups";
                            LookupRecord: Record "Vendor Posting Group";
                            RecRef: RecordRef;
                            FilterText: Text;
                            FieldValue: Text;
                        begin
                            LookupRecord.Reset();
                            LookupPage.SetTableView(LookupRecord);
                            LookupPage.Editable := false;
 
                            if LookupPage.RunModal() = Action::LookupOK then begin
                                LookupRecord.MarkedOnly := true;
                                LookupPage.GetRecord(LookupRecord);
                                Message('SelectedRecord: %1', LookupRecord.Count);
                            end;
                        end;
                    }
I have the same question (0)
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    20,971 Super User 2025 Season 2 on at
    Try with this: 
    if Page.RunModal(Page::"Vendor Posting Groups", Rec) = Action::LookupOK then
        Message('You selected: %1', Rec.Code);
  • One And Only Naveen Profile Picture
    460 on at
     
    Thank you for your response, I might be missing something from your suggestion as Rec is not available to use hence its not working..

    (The field is from a report's RequestPage snippet).
  • Verified answer
    One And Only Naveen Profile Picture
    460 on at
    @YUN ZHU Thanks for your Blog,
     
     
    Solution -
       field(VendorPostingGroup; VendorPostingGroup)
                        {
                            Caption = 'Vendor Posting Group';
                            ToolTip = 'Select the vendor posting group for the report.';
                            trigger OnLookup(var Text: Text): Boolean
                            var
                                LookupPage: Page "Vendor Posting Groups";
                                LookupRecord: Record "Vendor Posting Group";
                                RecRef: RecordRef;
                                CUSelectionMGT: Codeunit SelectionFilterManagement;
                            begin
                                Clear(CUSelectionMGT);
                                LookupRecord.Reset();
                                LookupPage.SetTableView(LookupRecord);
                                LookupPage.LookupMode(true);
                                if LookupPage.RunModal() = Action::LookupOK then begin
                                    LookupPage.SetSelectionFilter(LookupRecord);
                                    RecRef.GetTable(LookupRecord);
                                    VendorPostingGroup := CUSelectionMGT.GetSelectionFilter(RecRef, 1);
                                end;
                            end;
                        }
     
     
  • Verified answer
    YUN ZHU Profile Picture
    95,763 Super User 2025 Season 2 on at
    Very cool, thanks for sharing.

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

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,856

#2
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 765 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 581 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans