Salesforce Updates
MISSING SUBTEXT

Page Layouts, Meet Dynamic Forms!

Dynamic Forms allow users to modify a record detail page’s layout directly from the Lightning Page.

June 8, 2021

Since the dawn of Lightning in 2014, Salesforce has been slowly migrating pieces of the standard Sales Cloud platform from Classic into the new modern Lightning framework. One feature that has remained quite heavily rooted in the past is Page Layouts… until recently when Dynamic Forms was launched! 

Dynamic Forms is a brilliant new Salesforce feature that allows users to modify a record detail page’s layout directly from the Lightning Page. Users will no longer have to navigate to two different menus inside Setup to configure the User Interface around a particular record, now it can all be done at once inside the Lightning Page directly. In this article, we’ll look at what Dynamic Forms are, how to build and test them, and finally how to push them between Sandboxes and Production environments.

Dynamic Forms

What are Dynamic Forms?

Dynamic Forms are Salesforce’s solution to the current disconnect between Classic’s Page Layouts and Lightning Pages. The fields you want to display, as well as how you’d like to organise them, can be configured from the Lightning App Builder when you’re building your Lightning Pages, which speeds up the User Interface configuration workflow considerably. 

Dynamic Forms offer other benefits over Page Layouts as well. The Visibility Rules available on other Lightning Components within a Lightning Page can be used on fields in a Dynamic Form too. This means that the page adapts to what a User is doing, and when they’re doing it. 

One very important thing to note is that at this time, Dynamic Forms are exclusive to Custom Objects. According to Salesforce, this is due to a number of unique behaviours on some Standard Objects that need to continue to work. Salesforce is aware that Users want Dynamic Forms extended to Standard Objects, and have begun work on this. 

How to Build Dynamic Forms

The quickest way to begin the process and to open Lightning App Builder is to navigate to a record within a Custom Object, and click Edit Page from the Setup dropdown menu.

salesforce-setup

Once in the Lightning App Builder, select your Record Detail component (the one that currently contains your fields as dictated by the Page Layout), and click Upgrade Now.

record-detail

You’ll be asked to select the source for your Dynamic Form - ie. the Page Layout that you want to use as the foundation for it. Select the one that makes the most sense, and click Finish.

layout-dynamic-form


You’ll now find that all your fields and sections have been migrated into the Lightning Page as individual nested components. 

You now have the ability to freely move fields around on the Lightning Page as you would any other component. This means that your Dynamic Form can be split into multiple sections, and moved separately around the page. This is a HUGE change, and allows a lot more flexibility and freedom than Page Layouts could ever allow. You can also change whether your fields are always displayed or only displayed under certain circumstances using Filter Criteria. In the example below, you can see I’ve split the fields into two sections, and moved one of them into the right side column. 

dynamic-form-details


There’s also the ability to manage the visibility of fields and sections, as with other components on the Lightning Page. 

How to Push Dynamic Forms Between Environments Using BlueCanvas

In the screenshot below, I’m doing a quick comparison between my two Developer Environments, and the following screenshot shows the results - all the files (Salesforce metadata files) that are different between the two orgs. I’ve selected my Properties Lightning Page (in the Flexipage folder) and ticked the box to mark it for deployment.

blue canvas org compare


blue canvas select flexipage


From here, I gave my Deployment Request a title and clicked the Created Deployment Request button. Simple as that! My new Lightning Page, including the Dynamic Form I created before, has now been pushed through to my other org. Extremely simple!

BlueCanvas uses the Lightning Design System, which is why the UI looks like it fits right into the rest of the Lightning Experience.

Summary

Dynamic Forms are another example of Salesforce tweaking the Lightning Experience to near perfection. The remnants of Classic are slowly but surely disappearing, and new technologies are taking its place. Dynamic Forms brings your records to life and allows for greater control over the User Experience. 

More like this