What are dynamic forms and how do you deploy them with Gearset?
David Runciman on November 17th 2020
When Salesforce publishes its release notes, we're always interested to find out more detail about the latest goodies. In the Winter '21 Release Notes, dynamic forms are one of the things that caught our eye. This new feature offers a very welcome improvement for admins and developers looking for more granular control of Lightning record pages.
The advantage of upgrading to dynamic forms
If you have lots of fields on your page layouts, you'll have noticed that your record detail components easily become, in Salesforce's own words, 'a monolithic block'. Previously, you weren't able to customize fields, and this has led some admins to build multiple versions of the same page for different use cases.
Dynamic forms are Salesforce's solution to that problem. Once you've upgraded to dynamic forms, you'll be able to move fields around your layouts and use visibility rules to control when those fields appear.
At the moment, you can only upgrade to dynamic forms for record pages on custom objects. Hopefully we'll see them get rolled out for standard objects in future.
How to upgrade to dynamic forms
Upgrading to dynamic forms is easy. Open up one of your record pages with the Lightning app builder, where you'll see the option to Upgrade Now in the record detail pane. This button launches the migration wizard, which doesn't take long to work through.
Once you've upgraded to dynamic forms, you'll see a new Fields tab, with a set of new components. Drag and drop these components onto your page to start customizing your fields and sections. You'll need a field section component before you can add fields to it.
Dynamic forms open up some really useful options for configuration: you can decide how the page will work for mobile, and set conditions for when fields and components should be visible. These are improvements that will make life much easier for admins needing to create highly customized layouts.
How to deploy your changes using Gearset
Any new or changed layouts you create with dynamic forms are described with Lightning page metadata. Before you deploy this metadata (using any tool), you'll need to upgrade to dynamic forms manually in your source and target; the upgrade itself isn't a metadata change that can be deployed.
If you're deploying these changes in Gearset, first make sure that the
Lightning page metadata type is selected in the metadata filter when you compare orgs. You can also filter for the exact Lightning page you're wanting to deploy, which will speed up the comparison and simplify the deployment process.
At the comparison page in Gearset, you'll be able to see the differences between source and target in your
Lightning page metadata. Unless the entire Lightning page is new, the metadata will be found under Changed items.
Select the metadata to deploy and click Next. Give your deployment a friendly name, then choose whether to validate the deployment first, deploy straight away, or schedule the deployment for a release window.
Join the conversation!
What are your Winter '21 highlights? Let us know by opening up a chat with us from the website or the app - we always enjoy talking to you 😊
And to join in with even more conversation about all things Salesforce and DevOps, don't miss out on everything we're doing for Dreamforce to You!