Minimalism in Salesforce Dynamic Forms
How to hide fields in New mode?
I support the idea of showing only the absolute minimum number of fields when creating a new record, especially for a Case or an Opportunity. The rest of the information can be filled in after creation or when the user progresses through different stages of the record.
🚩 Problem
Recently, I upgraded a Case record page to use Dynamic Forms. After upgrade, I noticed that the ‘New Case’ popup shows a long list of fields. Though all of them are not mandatory fields, it still requires user to scroll through the fields, find the mandatory ones, enter information and then hit on the ‘Save’ button.
Wouldn’t it be simpler to show something like a Compact Layout, to just enter the bare minimum details to start off?
👀 Conditional Visibility in Dynamic Forms
Before getting to the solution, let’s see how Dynamic Forms allow conditional visibility. It can be implemented either just for specific fields or for whole sections.
For example, below configuration will ensure that the Status
field will be shown only if Case’s Type
value is ‘Other’.
So, if I now create a new record, then the field Status
will be hidden.
But, If I select the Type
as ‘Other’, then the Status
field appears.
Similarly, a whole section can be hidden by setting filter, as seen below. Here, the whole ‘Web Information’ section is set to be shown only if Case Origin
= Web.
Now coming back to our original problem of minimalistic ‘New Case’ popup. It sounds like conditional visibility is a good way to show and hide fields. But what type of condition would identify a Case record as new?
As a self respecting developer, I googled.
I haven’t started asking ChatGPT yet — I’ll let it learn a bit more and become more reliable 😉. Buried among numerous comments in Salesforce Support, I found the solution. Some solutions are like, when you read it itself, you are 100% sure that it will work. This was one of them.
🎨 Solution
The solution obviously is to hide all the non-mandatory fields from the UI, only when creating a new record. This may involve moving around the position of some of the fields, as it will be much easier from a maintenance point of view to hide whole sections, rather than put the same filter on numerous fields.
So, my first step was to bring up all the fields that are mandatory to the top section (Case Information
) in the page, like seen below. The below was done in a Trailhead Playground — So, the only mandatory fields are Status
and Case Origin
. Along with them, I have brought up some of the key information for a Case.
Now there are four other sections containing a lot of fields that can be hidden.
On each of these sections, a visibility filter is set to ensure that Created By User’s name is not blank : Record -> Created By -> Username NOT EQUAL to ‘’ (Blank). That means it is making use of the fact that, when a new record is being created (before save), the Created by -> Username will be blank.
Additionally, any fields that are not required to be shown in the top sections can also be given the same filter.
And the end result would be a simple input form with only a handful of fields like this:
📣 Considerations
- It need not necessarily be a good idea to have a minimalistic create page, as users may ignore entering information that is available to them, thereby reducing the data quality. Therefore, use this approach only if it suits your business requirement.
- I have noticed some of the System fields does not like being hidden. A warning error message gets thrown saying, some of the hidden fields may or may not get set. Therefore, test and ensure that the creation of record does not throw any warnings/error.