Salesforce has introduced the new feature Dynamic Forms(Non-GA Preview) in the Summer '20 release. It is basically an upgrade from page layouts. You can place a field in any section that you want & provide the ability to configure record detail page fields and sections inside Lightning App Builder. Now we can customize sections and fields of the record page as per the business needs. We can migrate the fields and sections from page layout as individual components into the Lightning App Builder and then, we can configure them just like the rest of the components on the page. However, we can build pages from scratch.
- Upgrade from page layouts: place fields & sections anywhere on the layout.
- Dynamic layout: Use visibility rules to show and hide fields and sections based on the criteria you defined.
- Improve page performance: Place fields and sections into accordion components which significantly improve page load times. Take advantage of a single assignment model for the Lightning page instead of dual model of assigning a Lightning page and the page layout.
- Easier layout management: Manage the fields and Lalso sections on your pages in the Lightning App Builder without touching the page layout editor. Lessen the number of page layouts with help of component visibility rules.
How can I enable Dynamic Forms
- From Setup, enter the Record in the Quick Find box, and then click “Record Page Settings”.
Figure 1: Setup
- In the Dynamic Forms section, flip the switch to “On” & click on “Save” button.
Figure 2: Record Page Setting
Let’s get started
- For any custom objects, we can migrate to an existing Lightning page or we can create a new record page. Here, I’m taking the example of a "Fruit" custom object.
- Go to the “Fruit”(Custom Object) record page and click on the “gear” icon then click on “Edit Page” button.
Figure 3: Fruit Custom object record page
- After it, you see new features appear in the Lightning App Builder, A new Fields tab in the component palette contains a brand-new standard Lightning Component called "Field Section" & "Field" components. You can add Field "Section" on the page, select the fields to add in the section.
Figure 4:Lightning App Builder
- We could start by dragging fields and sections, but there’s a much simpler approach - just click on "Upgrade Now" from the Record Detail properties pane to launch the Dynamic Forms migration wizard.
Figure 5:Lightning App Builder
- After it, the Dynamic Forms migration wizard starts, then click on "Next".
Figure 6: Dynamic Forms migration wizard
- On the next screen, it will ask for select a page layout as a source of dynamic forms, choose a page layout & click "Finish" to complete the Dynamic Forms migration wizard.
Figure 7:Set the page layout as Dynamic Forms source
- We have successfully migrated to the Dynamic forms, the new Field Section & the Field components that go inside it are desktop-only. It adds the “Record Detail – Mobile” component to pages so mobile users can see “Details” fields.
Figure 8:Record detail component after successfully migrated to dynamic forms
- Then we drag down the "Field Section" below the Information section. We change its label to "System Information" & choose 1 column style.
Figure 9:Adds Field Section component
- Then we set Fruit Name field as Required.
Figure 10:Set Fruit Name required
- Here, we add a filter to the field "Price" only shown when the "Status" as "Available". We can also add the advanced filters as per requirement.
Figure 11: Add visibility filter in price field
- Then click on “Save” and return back to Fruit record page now the Status was “Out Of Stock”, So Price field not shown on page layout.
Figure 12:Fruit record page with dynamic forms
- Change the Status as "Available" instantly Price field is visible.
Figure 13:Edit status field on Fruit record page
- Currently, Dynamic Forms support only custom objects record pages.
- The new Field Section & the Field components are not supported on mobile. So, you will need to add a new Record Detail – Mobile component.
- Existing page layouts still manage the related lists.
- We can add up to 100 fields per column in a Field Section component.
- Dynamic Forms aren't available on record pages that use pinned-region or custom page templates.