Friday, December 4, 2020

#msdyn365bc - How Do I Add Field in Table Fieldgroup?

Hi Readers,

Yesterday while reviewing a Upgrade Merge to 2020 Release Wave 2, I encountered a custom which was left during merge process.

Using Azure Develops I updated developers and the reply was that its not possible to add fields in base table filegroups. 

I thought this might be something that other developers are also following.

Please read till end. At the end of the article I have listed best practices and other things to remember regarding Field Groups.

We need to keep in Mind - 

  • As developers we need to understand that AL is constantly changing.
  • What was not possible 6 months ago may be possible Now.
  • Don't be the old NAV / GP developer that we know product Inside out.
  • Business Central Engineering team is adding features daily so think before you reply to a request.

Let's understand what are field groups and How we add fields in that?

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

Example - Customer drop-down in Sales order.


Field Group is also used to display information in Tile View of a List page and also on Mobile Client (as shown below).

Customers may like to add fields in the field group to add custom fields or base Microsoft fields based on the business requirement. 

For this demo we will add a custom field "Demo Field" in Customer Table and add that to field group.

Once field is added in Table Extension, we can also add a new area of field group.

For Changing 

  • Drop Down we will add fields that we need to anchor it to DropDown.
  • Tile View we need to anchor it to Brick.

For this example we will add custom field and also Payment ($) in DropDown and Payment ($) in Brick Field Groups.

After Publishing our changes, Drop down have two new fields.

And Tile View have one more field - Payment ($).


For a New Table you can add field group as shown below.



Things to Remember - 
  • To add field group the format is - fieldgroup(<Name>; <Field>).
  • Valid Values of Name are - DropDown and Bricks.
  • DropDown, for adding fields to the drop-down control.
  • Brick to display data as tiles.
  • The fieldgroups keyword cannot be inserted before the key control.
  • 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.
  • Developer can only add field in the Last Field using Table Extension.
  • Developers cannot removed base fields from field group using Table Extension.
  • By default, the Field Group named DropDown is interpreted as Brick when a Brick definition has not been set.
  • Developer cannot extend FieldGroup if it is not defined in base table.
Hope it make sense.

Let me know your views on same.

Stay Tuned for More.

Regards,
Saurav Dhyani
www.sauravdhyani.com

1 comment:

Popular Posts