In this post, I will share the details about Dynamic Form, a feature that was introduced in the Summer ’20 release. Dynamic Form was one of the top voted idea that was delivered. If you ever worked in Classic and Page layout, you know how flexible the page layout is. Admins can add fields, sections, buttons etc. with few clicks and then assign multiple page layouts to the different combinations of Profile and Record Type. Dynamic Form is bringing the same level of flexibility to the Lightning Experience. Excited?
This post will cover below –
- What is Dynamic Form?
- How to activate Dynamic Form?
- How to add/delete/arrange fields to Dynamic Form?
- How to change the UI behavior of the fields added in Dynamic Form?
- How to change the field visibility in Dynamic Form?
- Things to know before implementing Dynamic Form.
If you prefer watching videos, please click here, otherwise, the same video is posted at the end of this post.
Note – Dynamic Form is incomplete without Dynamic Action. They complement each other very well. In this post, I will be focusing mainly on Dynamic Form and then I will publish the second part, where I will be focusing mainly on Dynamic Action.
Great!. So without any further detail, let’s dive in.
What is Dynamic Form?
Dynamic Form was first introduced in the Summer ’20 release and then it became GA(Generally Available) in the Winter ’21 release. With the help of Dynamic Form, you now have the power to modify the way your page will look in different scenarios. Things you can do with Dynamic Form are –
- You can now add or delete single fields from the layout and for that, you are not required to modify the page layouts.
- You can control the UI behavior i.e. mark individual fields Read-Only, Required.
- Make the fields appear based on the visibility criteria.
- Improve Page Performance i.e. page rendering time.
How to activate Dynamic Form?
As of today, you can configure Dynamic Form for custom objects only. For standard objects like Accounts, Cases, it is not supported yet. You can check the road map for Dynamic Forms in the Trailblazer Group here.
You can either create or migrate an existing page to Dynamic Form. I will show both below –
Migrate existing page to Dynamic Form
Once you edit the record detail page and open the same in Lightning App Builder, you will get the option “Upgrade Now” on the right side of the page (This option is available when you click on the detail tab).
Click on “Upgrade Now” and then Next. Choose the layout you want to migrate and click Finish. You are done. You will be presented with the newly migrated Dynamic Form. I will tell you a little later in this blog post, what you can do here, but let’s think that you have successfully migrated one existing page layouts to Dynamic Form. You need to save and activate before Dynamic Form will appear in your org.
In order to create the new Dynamic Form, go to the custom object from Object Manager. And then click on Lightning Record Pages. That will show all the Dynamic Forms you have created/migrated for that custom object.
To create a new Dynamic Form, click on New and proceed with the new form.
How to add/delete/arrange fields to Dynamic Form?
Once the open the Dynamic Form in the Lightning App Builder by clicking on the edit page, you will find a new option called Fields on the left side of the page (displayed below in the screenshot). You can drag and drop fields in the main canvas or rearrange them.
In the below example, I have created a new section named “Course Details” and arranged custom fields under that section.
Below is how the record detail page will look like
How to change the UI behavior of the fields added in Dynamic Form?
Once a field is added to the Dynamic Form, you can change the field’s UI behavior by marking the field as “Read Only” or “Required”. With the field selected, you will find the option on the right side of the page in Lightning App Builder.
How to change the field visibility in Dynamic Form?
Once a field is added to the Dynamic Form, you can change the field’s visibility as well. In the below example, I am making sure that Course Fees will only be shown when the “Show Course Fees” is checked.
Below is how the record detail page will look like when the “Show Course Fees” is checked vs unchecked.
Things to know before implementing Dynamic Form
- Once a Lightning Page is upgraded to Dynamic Form, you are not allowed to go back. But you can delete the Field Section component, and then add back the “Record Detail” component which will then again use the classic page layout.
- The new Field Section and Field components are not supported on Mobile.
- Regarding related lists, traditional page layouts will still make sure which related lists will be displayed.
- Component Visibility filter is having limited options like “Is Blank” or Is Not Blank” operators are not supported. There is an Idea open.
Video
In the next post, I will share details about Dynamic Actions.