Dynamic forms are one of the game-changer for the lightning platform. Now we can declaratively customize the section and the fields of the detailed section or create your customized section without any coding pattern and no need to create the multiple page layout.
One of the biggest advantages of the dynamic form is filter option on a section (will cover below). Even we can also filter the specific fields based on permission, record, user. The filter works on WHEN, WHOM and ON.
Dynamic Forms benefits you in these ways:
- An instant upgrade from page layouts: Place fields and sections wherever you want with the help of Lightning App Builder.
- Better page performance: Put fields and sections into Standard accordion components, tabs to significantly improve page load times.
- Dynamic layouts: Use visibility rules to make fields and components appear based on criteria we choose.
- Minimize the use of Page layout.
How to Work with Dynamic Forms
Enable the Dynamic Form: Go to Setup -> search Record page setting -> enable the dynamic form.
Look into the new section in the lightning app builder page. you will have a Field section in the left bar. This is the Option for Lightning Dynamic form.
We can add or experienced the dynamic form in two way
- By using the existing Record Detail Page or migrate a page.
- Adding the new layout.
Migrate a page
For existing record pages, you could start by dragging fields and sections, but there’s a much easier way. Open your page in the Lightning App Builder, click the Record Detail component, and you see a new area at the top of the Record Detail properties pane. Click on the Upgrade Now and follow the instruction add the layout and save.
Adding the New Layout
Drag and Drop the field section on the right side.
As we can see we can add the new custom fields form (My Section). we can even manage the layout with the column option. In this section, we can select the fields from the left panel.
We also have the filter option for the specific section. Filter helps to restrict access to the layout which is a big advantage of the dynamic form. The filter works in two way
- Apply filter to section
- Apply filter to fields
A filter is categorized into three forms
- Record Fileds
- Device
- Advance: This restricts based on user, record, permission and Device.
We can also manage the field UI Behaviour in dynamic form.
Note: Fields can only be dropped inside a Field Section component.
Dynamic Form Quick Action
We can also add dynamic action. This also helps to render the action buttons based on the filter.