Skip to main content

Notifications

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

How do I create a new field that uses a multiple select dropdown menu?

Posted on by 101

Goal: My contact wants to be able to create a dropdown menu where you can have multiple options selectable and storable for this custom field. We would like this to be applied to the Item Card header.

pastedimage1665107373344v1.png

End goal concept

Alternatively, they would like to create about ten dropdown fields in Business Central while keeping the use of purchases to a minimum if the above goal is currently unattainable.

We have in mind that the ten dropdown fields will contain varying multiple different options and each option will be unique and will differ from each other dropdown field.

Please also be aware that I am of a low code/non-developer background.
Any help is much appreciated.

  • Verified answer
    Joseph.Candava Profile Picture
    Joseph.Candava 101 on at
    RE: How do I create a new field that uses a multiple select dropdown menu?

    Since I was unable to create the multiple select drop down menus, I have opted for the ten individual Option Lists (Enum) described in this source: https://yzhums.com/5985/  as I spent way too much time attempting to get a Lookup list (Multi Select) solution to work where I recall the equivalent of the Text += PurchaseCodeList.GetSelectionFilter(); was pulling up an error against the specific "Purchase Code List" page saying that GetSelectionFilter was not recognised as an existing function. I looked up how to rebuild GetSelectionFilter to work for the Purchase Code List page indicated here https://yzhums.com/27561/ but I was unsuccessful and ended up confused following this guide.

  • Joseph.Candava Profile Picture
    Joseph.Candava 101 on at
    RE: How do I create a new field that uses a multiple select dropdown menu?

    Thanks for this response.

    I made the attempt of writing up something that uses the "Purchasing Codes" as the lookup page to base my selections off as the variable PurchaseCodeList.

    layout
        {
            addlast(InventoryGrp)
            {
                field(MyField; Rec.MyField)
                {
                    ApplicationArea = all;
    
                    trigger OnLookup(var Text: Text): Boolean
                    var
                        PurchaseCodeList: Page "Purchasing Codes";
                    begin
                        PurchaseCodeList.LookupMode(true);
                        if not (PurchaseCodeList.RunModal() = Action::LookupOK) then begin
                            Clear(Rec.MyField);
                            exit(false);
                            Text := PurchaseCodeList.GetSelectionFilter;
                        end else begin
                            exit(true);
                        end;
                    end;
                }
            }
        }

    I am currently having the problem where I am trying to add this portion of the code in my .al file but it is giving me an error message in the Problems console output tab: 'Page "Purchasing Codes"' does not contain a definition for 'GetSelectionFilter'

    Text := PurchaseCodeList.GetSelectionFilter;

    I have seen seen the source https://yzhums.com/27561/ to see how to get the GetSelectionFilter to work but I am unsure how to obtain the GLAccountList.Page.al or how to produce one myself.

    I have attempted to create a file containing codeunit 46 selectionFilterManagement with my current VSCode settings but I am still getting the same 'Page "Purchasing Codes"' does not contain a definition for 'GetSelectionFilter' error after confusing myself that I thought that I have provided this definition with this file.

    At the moment, I have gotten the Purchasing Codes page to show on the drop down menu but selecting a single or multiple values does not return the selection in the text box of my field.
    Completely appreciated the help so far.

  • YUN ZHU Profile Picture
    YUN ZHU 73,472 Super User 2024 Season 2 on at
    RE: How do I create a new field that uses a multiple select dropdown menu?

    Hi, Just to add an example for Daniele's idea.

    How to get a filter for the selected records on any page (For example, ‘1..3|6’)

    https://yzhums.com/27561/

    Hope this helps.

    Thanks.

    ZHU

  • Amit_Sharma Profile Picture
    Amit_Sharma 2,545 on at
    RE: How do I create a new field that uses a multiple select dropdown menu?

    Hi,

    Adding info-:

    https://erpconsultors.com/creation-of-table-in-dynamics-365-bc/

    Regards

    Amit Sharma

    www.erpconsultors.com

  • DAnny3211 Profile Picture
    DAnny3211 9,272 Super User 2024 Season 1 on at
    RE: How do I create a new field that uses a multiple select dropdown menu?

    Hi

    I would add that in order to retrieve the field values with the example string Value1|Value3..Value4|Value2

    you will just need to create a function that filters the table with all possible values and insert them where needed for example in a print report or page

    DAniele

  • DAnny3211 Profile Picture
    DAnny3211 9,272 Super User 2024 Season 1 on at
    RE: How do I create a new field that uses a multiple select dropdown menu?

    Hi

    My idea would be as follows:

    create a table where all possible values of the new field will be entered.

    Hook the new field with a Lookup AL to the page of the table of possible values, so as to make a multiple selection, and insert in the new custom field the selected values as in the example:

    Value1|Value2..Value3|Value4

    in order to retrieve the values from the custom field you would have to make a function that parse the string.

    You can take the Totaling field of the G/L Account as a reference and see on the G\L Account Card page the code under the Lookup of the Totaling field:

    "GLAccountList.LOOKUPMODE(TRUE);

    IF NOT (GLAccountList.RUNMODAL = ACTION::LookupOK) THEN.

     EXIT(FALSE);

    Text := OldText + GLAccountList.GetSelectionFilter;"

    Greetings

    DAniele

    create a field similar to the TOtaling of the G/L Account

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans