Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Suggested answer

Lookup filter Business central?

Posted on by 65

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.

Categories:
  • Lookup filter Business central?
    can you please share the code of  the lookup you get the filtered records with Template Type ASSETS
  • peopleeater Profile Picture
    peopleeater 65 on at
    RE: Lookup filter Business central?

    Nitin Verma

    It really worked, thank you very much.

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,023 Moderator on at
    RE: Lookup filter Business central?

    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;

            }
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 69,639 Super User 2024 Season 2 on at
    RE: Lookup filter Business central?

    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
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,744 Moderator on at
    RE: Lookup filter Business central?

    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.

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

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

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 228,493 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans