web
You’re offline. This is a read only version of the page.
close
Skip to main content
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 448
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
    19,517 Super User 2025 Season 2 on at
    GetSelectionFilter() Alternative
    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
    448 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).
  • Verified answer
    One And Only Naveen Profile Picture
    448 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;
                        }
     
     
  • Verified answer
    YUN ZHU Profile Picture
    93,438 Super User 2025 Season 2 on at
    GetSelectionFilter() Alternative
    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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
Sumit Singh Profile Picture

Sumit Singh 2,204

#2
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 1,933

#3
YUN ZHU Profile Picture

YUN ZHU 1,885 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans