In the Summer 2020 release, Salesforce brought a few fantastic ideas into reality.
A 13-year-old idea on Salesforce Idea Exchange is rolled out in all Salesforce instances across the world (GA from winter 2021).
Dynamic Forms a.k.a. Lightning Layouts adds more power to the Lightning App Builder, eventually more
power to admins.
With Dynamic Forms you can,
- manage the fields and sections of the lightning pages right from the app builder.
- remove the dependency of page layouts for assignments and access setups.
- drag and drop fields on lightning pages in the accordion sections.
- hide or show the fields based on the data on the record.
- upgrade the existing page layouts to Dynamic Forms.
- speed up the page loading.
As of now, Dynamic Forms are supported for custom objects only. Soon it will be available for the standard objects too.
How to enable it?
Got to Setup -> Search 'Record' in the Quick find box, -> click Record Page Settings -> switch on the Dynamic Forms.Enable Dynamic Forms From Setup |
Note: This might not be available in your org if you are reading this before Summer '20 release, follow this link to create the Release Preview Org. Some of the sandboxes have already been enabled Summer '20 release.
Let's give it a spin!
Have you it enabled in your org or signed up for release preview org? Great! Let's create one dynamic form. For the demo purpose, I have created a custom object called Student, which you can use on your own.Go to your desired custom object record, click the gear icon, and click the edit page, you will be redirected to the Lightning App Builder.
Now, the first thing you need to do is, convert the page layout to the dynamic form. Click on the record detail component. On the right side, you will see a screen like below.
Upgrade to dynamic forms |
After you click "upgrade now", you will see a below screen:
Select Layout To Copy |
Now you need to select an existing page layout to generate the dynamic form. Select one of your choices, and click finish. I will select the Student Layout.
Here the magic happens you have got your first dynamic form. You will see there are some of the new sections in the app builder. Like the "Fields" tab on the left side and record details component is replaced with the new form.
Auto-Generated Dynamic Form |
How to add fields to the layout?
- On the left panel, click on the Fields tab.
- There you will see a list of all fields on the object.
- Just drag and drop the fields you want on the "fields" layout. See the below image.
How to set visibility of the fields based on values?
The coolest thing in dynamic form is that you can show or hide the fields and field sections based on the data on the record. I will illustrate this with the simple Student registration form example.
Assume, this is the simple application form of a University in India, students from all over the world can apply. The institute wants to collect the passport and visa details of the international students.
So based on the student's country, if it is other than India I want to show the
Passport Number, Passport Valid Till, Visa Details, Visa Valid Till, Type Of Visa
fields. Follow the steps to set conditional field visibility. [The video on step #5]
- Click on the field to "Add Filter". (Use UI Behaviour options to set the field as required or read-only). Refer below the screenshot.
- Now select filter options, field, operator, and value. In my example, I have used
Country != IN
.
Click "Done". - Use the "Advanced" section if you need Global Variables, User Fields, and Related Fields of the records.
- Repeat the same steps for other fields.
- See Video.
Conclusion
Dynamic Forms gives you the ability to drag and drop fields on the lightning app builder itself, also reduces the efforts we could have needed to build the custom Lightning component.
Also, Salesforce is gradually removing dependencies of classic things like page layouts and giving us a brand new customization option.
Let me know what do you think about this new feature? What can be the usual business cases for this
Tell me in the comments if you need any help!
Peace ☮!!
Pretty much straight forward.. Good explanation Rahul
ReplyDeleteThanks!!
Delete