Please enter your search criteria to begin searching

Dynamic Forms in Salesforce Lightning Record Pages

In this part, we will be taking a look at a new feature called Dynamic Forms. This allows you to place fields on your Lightning page in a similar way to other components. This is very new so I am sure we’ll see enhancements over time, but we’re going to look at the basics here.

Welcome to part three of our series on Lightning pages. At the beginning we looked at how to customise Lightning record pages and talked about a few of the components available to add to them. Then we looked at some of the possibilities afforded to you by Conditional Visibility. In this last installment, we take a look at Dynamic Forms. 

Enabling Dynamic Forms

This is currently only available on custom objects, so that means that all this cleverness is not going to be available on Contacts and Accounts for example just yet. I would hope that in the long run this feature rolls out to all standard objects too, but for now it is only custom ones.

If you are using a Winter ‘21 preview sandbox this is already available to you and enabled by default and you will not need to do anything in this section. If you are on an earlier version, you will need to enable it first.

To enable Dynamic Forms, go to Setup. Use the search bar on the left for the page to find Record Page Settings. The top section of the page gives you details and allows you to enable Dynamic Forms for your org. There are some links to some of the documentation too so that you can check over the detail.

Record Page Customisation

In this example, we are a travel and excursions company who needs to collect information about our travellers to make sure they can be covered by our insurance and insured before they travel with us. If you have ever been through a process like this, you’ll remember that there are lots of medical questions and depending on the answers to the basics, more questions can pop up.

We have started here by just demonstrating the basic capability of Dynamic Forms. I have been able to put the created by field right at the top of the page. This is not a custom lightning component or anything similar, this is core Salesforce functionality configurable in a point and click interface. I can put fields from my custom object anywhere on my page in the same way as any other Lightning component and all the usual capabilities we have talked about previously apply so I can have different pages for different devices or users and make them appear and disappear depending on criteria I set.

Creating a Dynamic Form

Now we have talked about the basics, let’s take some time to look at the example use case in more detail. One of the reasons it works in this example is that when someone answers yes to one of the questions, a lot of extra bits of information may need to be gathered. In this very short example form, we have used Dynamic Forms and Conditional Visibility to make more questions appear. My customer answered yes to having allergies but not to anything else. When saving the record, the allergy details section of the page appeared, but other sections remained hidden. All these fields are stored on the same record in my Traveller Details custom object, but I can show just a small portion of the fields on the page.

You start by adding a “Field Section” lightning component to the page from the new “Fields” tab that has appeared on the Lightning app builder for Lightning record pages. You give the Field Section a title and can chose a single or double column layout in a similar way to standard page layouts. You can then drag and drop in fields from the object. The normal options to make a field either required or read only on the page apply. You can even put a field on the page more than once which for objects with a lot of fields is definitely something I have had customers ask me in the past. 

Let’s go a step further and put some general record information on the right-hand side bar. This combined with the Highlights Panel now gives me another way to separate key information from the rest on my page. Previously achieving this was possible but did take some messing about or custom Lightning components.

The possibilities this gives to an administrator or developer to be able to create pages to allow their Salesforce users to have clear, concise pages that do exactly what they need are incredible. This kind of capability has always required tricks or coding in the past. Now it can be done declaratively with the standard point and click tools. This is a massive and very exciting step from Salesforce.

Why not contact us to see what other options there are.


© Copyright Stimulus Consulting 2015