Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Open a filtered List

Posted on by 18
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.
Categories:
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    Khushbu Rajvi. 4,104 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 72,330 Super User 2024 Season 2 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 18 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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,961 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,443 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans