Skip to main content

Notifications

Community site session details

Community site session details

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

GetSelectionFilter() Alternative

(3) ShareShare
ReportReport
Posted on by 269
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
    One And Only Naveen Profile Picture
    269 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
    269 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
    14,464 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 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,118 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,866 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans