Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

Open a filtered List

(1) ShareShare
ReportReport
Posted on by 24
I have a custom table and List in BC (Specifications). One field in this table contains and item number that matches an Item Number in BC. When I am on the Sales Order Line that contains an Item Number, I would like to use something like a trigger OnAssistEdit ( or some other Action) that will open the List (Specifications) and only show the record in that table where the field (Invtld) matches the Item Number. 
 
I have worked through examples but have not been able to get the result required.
 
Any suggestions are appreciated.
 
Thanks.
  • CU03102009-0 Profile Picture
    CU03102009-0 24 on at
    Open a filtered List
    Thank you Khushbu RajviYUN ZHU!
     
    You people are the best!
     
  • Verified answer
    Khushbu Rajvi. Profile Picture
    Khushbu Rajvi. 8,216 Super User 2025 Season 1 on at
    Open a filtered List
    Hi, Try with the below. 
     
    pageextension 50732 "Specifications Test" extends "Sales Order Subform"
    {
        layout
        {
            modify("No.")
            {
                AssistEdit = true;
                trigger OnAssistEdit()
                var
                    SpecList: Page "Specifications List";
                    SpecRec: Record Specifications;
                begin
                    if Rec."No." = '' then begin
                        Message('Item Number cannot be blank.');
                        exit;
                    end;
                    SpecRec.SetRange("Item No", Rec."No.");
                    SpecList.SetTableView(SpecRec);
                    if SpecList.RunModal() = Action::LookupOK then begin
                        Message('You selected a specification.');
                    end;
                end;
            }
        }
    }
     
     
    Hope this helps.
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 77,351 Super User 2025 Season 1 on at
    Open a filtered List
    I think you have to put SpecItem.SetFilter("Invtld", rec."No.") before SpecList.RunModal().
    In addition, you did not use Page.SetSelectionFilter method, so you can't get the No. currently selected by the user.
     
    Hope this can give you some hints.
    Thanks.
    ZHU
     
  • CU03102009-0 Profile Picture
    CU03102009-0 24 on at
    Open a filtered List
    This is what I had so far but the list is not filtered...al items show.
     
    pageextension 50102 "Specifications Test" extends "Sales Order Subform"
    {
        layout
        {
     
            addlast(content)
            {
                /*             usercontrol(popup; popup)
                            {
                                Applicationarea = all;
     
                            } */
            }
            modify("No.")
            {
                AssistEdit = true;
                trigger OnAssistEdit()
                var
                    ItemList: Page "Item List";
                    SpecList: Page "Specifications List";
                    Item: Record Item;
                    SpecItem: Record Specifications;
                    LineNo: Integer;
                    SL: Record "sales Line";
                Begin
                    Message('You selected %1', rec."No.");
     
                    SpecList.LookupMode := true;
                    If SpecList.RunModal() = Action::LookupOK Then begin
                        SpecItem.SetFilter("Invtld", rec."No.")
                    end;
                End;
            }
        }
    }

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,234 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,994 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans