Skip to main content
Community site session details

Community site session details

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

GetSelectionFilter() Alternative

(4) ShareShare
ReportReport
Posted on by 380
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;
                    }
  • Verified answer
    YUN ZHU Profile Picture
    85,984 Super User 2025 Season 1 on at
    GetSelectionFilter() Alternative
    Very cool, thanks for sharing.
  • Verified answer
    One And Only Naveen Profile Picture
    380 on at
    GetSelectionFilter() Alternative
    @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;
                        }
     
     
  • One And Only Naveen Profile Picture
    380 on at
    GetSelectionFilter() Alternative
     
    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).
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    17,526 Super User 2025 Season 1 on at
    GetSelectionFilter() Alternative
    Try with this: 
    if Page.RunModal(Page::"Vendor Posting Groups", Rec) = Action::LookupOK then
        Message('You selected: %1', Rec.Code);

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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,655

#2
Mansi Soni Profile Picture

Mansi Soni 1,574

#3
YUN ZHU Profile Picture

YUN ZHU 1,453 Super User 2025 Season 1

Featured topics

Product updates

Dynamics 365 release plans