Hi, Readers.
Today I would like to briefly discuss a question I was asked recently, why are the newly added fields in drop-down not displayed? (For example, add item Search Description to DropDown fieldgroup)
A field group in table or table extension objects defines the fields to display in a drop-down control on pages that use the table. The DropDown control is used to select a record from a list of records. For example, table 27 Item -> DropDown fieldgroup

Sales Line -> No.:

Item Journal Line -> Item No.:

You add a field to include in a drop-down control by using the DropDown
field group name in the keyword. The following example illustrates how to add the field:


More details: Dynamics 365 Business Central: How to Customize Drop-Down List (Field Groups)
There is a problem here. For example, I added two fields, “Search Description” and “Vendor No.”.

But only “Vendor No.” is displayed. Why?

There is a gotcha, which Microsoft also mentions in MS Learn (Docs).
Field groups (DropDown controls):
If the field you’re adding to the DropDown has Visibility = false
on the underlying lookup page, it won’t show up in the drop-down.

Let’s see more details.
table 27 Item -> LookupPageID = “Item Lookup”:
PS: LookupPageId Property: Sets the ID of the page you want to use as a lookup.

page 32 “Item Lookup”:

So for these fields that are hidden by default in the lookup page, we need to do one more step.

After republishing the extension, we can find that “Search Description” is also displayed.

Very simple. Give it a try!!!😁
Test code:
tableextension 50115 ItemExt extends Item
{
fieldgroups
{
addlast(DropDown; "Search Description", "Vendor No.")
{ }
}
}
pageextension 50115 ItemLookupExt extends "Item Lookup"
{
layout
{
modify("Search Description")
{
Visible = true;
}
}
}
PS:
1. You can also add new fields without modifying the Visible property of existing fields. For example,

2. Business Central 2023 wave 2 (BC23): Add a new FieldGroup (Brick & DropDown) to an existing table
END
Hope this will help.
Thanks for reading.
ZHU
コメント