I got an interesting question today, is it possible to add new fields to the Drop-Down list when selecting items on a Sales Order line?
Yes, we can achieve it very easily.
In this post, I will share how to how to customize drop-down List.
Field Groups (Drop-Down Controls)
First we need to know the important controls related to drop-down List, Field Groups.
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.
Syntax of fieldgroup is as follows:
<Name>: can be either DropDown, for adding fields to the drop-down control, or Brick to display data as tiles.
<Field>: is a comma-separated list of the fields, by name, to include in the group.
For example: table 27 Item
Item drop-down List
Add fields to the Field Group
So In Business Central, we can use Table Extension object to add one or more fields to the fieldgroup using the ‘fieldgroups’ control.
It can be done by using the addlast keyword. (Only addlast)
I added three fields, “Search Description”, “Unit Cost” and “Vendor No.”.
You can also use newly added fields to search items.
1. You can also add newly created fields to Field Group in Table Extension.
2. Please do not add the flowfield fields, because it will not be recalculated in drop-down List.
3. You cannot choose where to append fields (Only have addlast keyword), nor can you delete existing fields.
4. The syntax for using a DropDown, must be exactly DropDown with the right capitalization.
5. The server will remove the duplicates, if multiple extensions attempt to add the same field more than once. A field can only be added to the field group once.
Find out more about Field Groups from Microsoft Docs.
Hope this will help.
Thanks for your reading.