web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Business Central forum

Show DropDown on a Page

(0) ShareShare
ReportReport
Posted on by 15

Hello,

I have developed a Business Central extension, which submits data to a 3rd party web service. I have created an Item Card page extension, which displays a modal page. I am trying to show a drop-down field with values from a custom table. The goal is to submit an HTTP request once the user selects an item from the drop-down.

How can I show a drop-down control with items from a table and add it to a page?

Thanks!

Categories:
  • Suggested answer
    Stefano Demiliani Profile Picture
    37,172 Most Valuable Professional on at

    Creare a field and handle the TableRelation property. In this way you’ll have automatically the dropdown selection.

    Alternative: create the field on the page and handle the OnDrillDown (or OnLookup) event.

  • Nikolay Arhangelov Profile Picture
    15 on at

    Here are some details around my implementation. There is a new table called Template:

    table 50111 "Template"
    {
        DataClassification = CustomerContent;
    
        fields
        {
            field(1; "No."; Integer)
            {
                DataClassification = CustomerContent;
                AutoIncrement = true;
            }
    
            field(2; Template; Text[50])
            {
                DataClassification = CustomerContent;
                NotBlank = true;
            }
        }
    
        keys
        {
            key(PK; Template)
            {
                Clustered = true;
            }
        }
    }

    I created a new page with the following code based on Stefano's suggestion.

    page 50113 Print
    {
        PageType = Card;
        ApplicationArea = All;
        UsageCategory = Administration;
        SourceTable = Template;
    
        layout
        {
            area(Content)
            {
                group(GroupName)
                {
                    field(Template; Template)
                    {
                        ApplicationArea = All;
                        TableRelation = Template.Template;
                        Lookup = true;
                        LookupPageId = "Templates List";
                    }
                }
            }
        }
    }

    The page shows a single field and not a drop-down. I also tried with DrillDown and DrillDownPageId.
    This new page acts as a generic page where the user picks an item from the Template table and it should not be related to any other data.

    I tried adding an Item extension, which adds a table relation to Template - in this case I see the Template drop-down, but it's per item.

  • Nikolay Arhangelov Profile Picture
    15 on at

    Thank you for the suggestion, Stefano! I created the following page:

    page 50113 Print
    {
        PageType = Card;
        ApplicationArea = All;
        UsageCategory = Administration;
        SourceTable = Template;
    
        layout
        {
            area(Content)
            {
                group(GroupName)
                {
                    field(Template; Template)
                    {
                        ApplicationArea = All;
                        TableRelation = Template.Template;
                        Lookup = true;
                        LookupPageId = "Templates List";
                    }
                }
            }
        }
    }


    This shows a drop-down, but it is uses SourceTable = Template. Is there any way to decouple it from a table?

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 Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

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

Leaderboard > Business Central

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans