What are Salesforce Dynamic Forms?
The purpose of Dynamic Forms is to create more intuitive page layouts that display the right information at the right time. Over time, the page layout, or “Details” section in Lightning pages, can become congested with fields that may not be necessary all the time and for all users.
For example: You have an accountant, Jenny, working on your transactions. You have a field called "Jenny's Notes" that only needs to be visible by the system admin and accounting. You can create visibility filters to make this only available to certain profiles.
The previous solution to this was to create several page layouts and assign them to different users so they only saw that they needed to see, but this was a lengthy process that often became confusing.
Dynamic Form functions:
Place fields anywhere on the layout without needing to add them to the traditional page layout (“Details” component).
Use visibility rules to make fields and components appear and disappear based on criteria you choose.
Do away with multiple page layouts.
Improve page load times.
Are Dynamic Forms Available for Standard Objects?
Dynamic Forms are supported on hundreds of standard objects! Specifically, support has been extended to the majority of Lighting Web Component enabled standard objects.
Dynamic Forms are not available on objects that do not support Lighting Web Components, including Campaigns, Tasks, and Products.
To confirm if an object supports Dynamic Forms, edit the record page on the Lightning App Builder--
Go to the tab you would like to edit
Click into any record
Navigate to the Setup dropdown (Lightning Cog Icon)
Click Edit Page from the dropdown
If you see the “Fields” tab in the component panel on the left hand side, Dynamic Forms are available.
1. Create or Migrate a Page
Open the Lightning page you wish to upgrade--
Go to the tab you would like to edit
Click any record
Navigate to the Setup dropdown (Lightning Cog Icon)
Click Edit Page
Select the “Record Detail” or “Highlights Panel” component
Choose “Upgrade Now” from the right hand side.
You can also create a brand-new page--
Navigate to Setup
Object Manager
Choose the object you'd like to create the page on
Select Lightning Record Pages
Choose New.
Once you’ve migrated or created a new Lightning record page, you will see the option to add a “Field Section” component which will then enable you to add fields directly to the Lightning record page.
In this example, The traditional “Details” tab has been removed and a custom tab called “Candidate Information” was created. I then dragged a “Field Section” component onto my tab.
Note: You need to add a Fields Component before you are able to add fields!
2. Add Fields to a Component
Once you’ve added a “Field Section” component to your page, you can start to add individual fields. A “Field Section” can be added in many places, not just within tabs.
First, let’s add some fields that should always be visible to anyone who views the record:
Don’t forget to name each field section!
With a field selected, you can choose the UI behavior such as “Read Only” or “Required”.
3. Make Fields and Components Conditionally Visible
We can make both fields and entire field components conditionally visible.
Below, I’ve added a new “Fields Section” component titled “Confidential Information”, and made it visible only to users with the Profile name “HR”:
I’ve also made the field “Distance Willing to Travel” conditionally appear only if “Willing to Travel” equals TRUE:
In edit mode, our conditional field will appear once “Willing to Travel” is checked, without the user having to save or refresh the page.
NOTE: Field visibility and Field Section visibility behave differently. Although both are dynamic e.g. can be set to appear or disappear based on filters you define, Fields are super dynamic as they are evaluated live (as a user makes changes). This means that a field may appear/disappear while a user is editing a record. In contrast, Field Sections are only evaluated on Save, so a new section won’t appear/disappear until the user saves the record.
For Visual Learners-- Click the video below to watch the Dynamic Forms Series: