web
You’re offline. This is a read only version of the page.
close
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...
Suggested Answer

Lookup filter Business central?

(0) ShareShare
ReportReport
Posted on by 67

Hello, Community I'm a learner, and need some help.

I want to get the lookup for all fields of table 232 "Gen. Journal Batch", so I have added the relationship with my custom table,

pastedimage1661271763640v1.pngpastedimage1661271854737v2.png

After adding the lookup I get the filtered records with Template Type ASSETS

pastedimage1661272021316v3.png

But I want to get all the records of the "Gen. Journal Batch" Table

pastedimage1661272131585v4.png

PS. I can add all the fields in my lookup field, but I want to select it from lookup and I only get the filtered records from the lookup.

I have the same question (0)
  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,111 Moderator on at

    I think it will be easier to help you if you share the complete code.

    Can be a lot going on in your code that we don't see from what you share.

  • Suggested answer
    YUN ZHU Profile Picture
    95,754 Super User 2025 Season 2 on at

    Hi, It looks like you are using TableReleation for Lookup, here are some other methods that I hope will give you some hints.

    How to create a Lookup, Drop-Down, or Option list (Single and Multi select)

    https://yzhums.com/5985/

    Thanks.

    ZHU

  • Suggested answer
    Nitin Verma Profile Picture
    21,708 Moderator on at

    Hi,

    If you will run alone a General Journal Batch if would not show you all the records of Table 232, because this tables has a LookupPageID property set as Page "General Journal Batches"; page ID 251.

    And the page id 251 has some method sets which filters the General Journal templates so that it shows only those batches which belongs to the particular templates. like in your case it showing only two Assets records.

    To achieve your requirement you have to  create a Custom page of Page 232 and remove everything from the custom page's OnOpenPage trigger see below, and then you have to use OnLookup Trigger instead of TableRelation property.

    page 50005 "Gen. Journal Batches"
    {
        ApplicationArea = All;
        Caption = 'Gen. Journal Batches';
        PageType = List;
        SourceTable = "Gen. Journal Batch";
        UsageCategory = Lists;

        layout
        {
            area(content)
            {
                repeater(Control1)
                {
                    ShowCaption = false;
                    field(Name; Name)
                    {
                        ApplicationArea = Basic, Suite;
                        ToolTip = 'Specifies the name of the journal you are creating.';
                    }
                    field(Description; Description)
                    {
                        ApplicationArea = Basic, Suite;
                        ToolTip = 'Specifies a brief description of the journal batch you are creating.';
                    }
                    field("Bal. Account Type"; "Bal. Account Type")
                    {
                        ApplicationArea = Basic, Suite;
                        ToolTip = 'Specifies the type of account that a balancing entry is posted to, such as BANK for a cash account.';
                    }
                    field("Bal. Account No."; "Bal. Account No.")
                    {
                        ApplicationArea = Basic, Suite;
                        ToolTip = 'Specifies the number of the general ledger, customer, vendor, or bank account that the balancing entry is posted to, such as a cash account for cash purchases.';
                    }
                    field("No. Series"; "No. Series")
                    {
                        ApplicationArea = Basic, Suite;
                        ToolTip = 'Specifies the number series from which entry or record numbers are assigned to new entries or records.';
                    }
                    field("Posting No. Series"; "Posting No. Series")
                    {
                        ApplicationArea = Basic, Suite;
                        ToolTip = 'Specifies the code for the number series that will be used to assign document numbers to ledger entries that are posted from this journal batch.';
                    }
                    field("Reason Code"; "Reason Code")
                    {
                        ApplicationArea = Basic, Suite;
                        ToolTip = 'Specifies the reason code, a supplementary source code that enables you to trace the entry.';
                    }
                    field("Copy VAT Setup to Jnl. Lines"; "Copy VAT Setup to Jnl. Lines")
                    {
                        ApplicationArea = Basic, Suite;
                        ToolTip = 'Specifies whether the program to calculate VAT for accounts and balancing accounts on the journal line of the selected journal batch.';
                    }
                    field("Allow VAT Difference"; "Allow VAT Difference")
                    {
                        ApplicationArea = Basic, Suite;
                        ToolTip = 'Specifies whether to allow the manual adjustment of VAT amounts in journal templates.';
                    }
                }

            }
        }
    }

    Field OnLookup Trigger.

            field(50006; "General Jnl Batch"; code[10])
            {
                Caption = 'General Jnl Template';
                DataClassification = ToBeClassified;
                trigger OnLookup()
                var
                    GenJnlBatch: Record "Gen. Journal Batch";
                    GenJnlBatches: Page "Gen. Journal Batches";
                begin
                    GenJnlBatch.Reset();
                    GenJnlBatch.SetRange(Name, "General Jnl Batch");
                    GenJnlBatches.SetTableView(GenJnlBatch);
                    GenJnlBatches.RunModal();
                end;

            }
  • peopleeater Profile Picture
    67 on at

    Nitin Verma

    It really worked, thank you very much.

  • Community member Profile Picture
    2 on at
    can you please share the code of  the lookup you get the filtered records with Template Type ASSETS

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,132

#2
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 675 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 665 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans