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

(4) ShareShare
ReportReport
Posted on by 368
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
    82,673 Super User 2025 Season 1 on at
    GetSelectionFilter() Alternative
    Very cool, thanks for sharing.
  • Verified answer
    One And Only Naveen Profile Picture
    368 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
    368 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
    16,318 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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

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

#1
YUN ZHU Profile Picture

YUN ZHU 374 Super User 2025 Season 1

#2
Mansi Soni Profile Picture

Mansi Soni 247

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 231 Most Valuable Professional

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans