Conditional Field Formatting in Salesforce with Example

Conditional Field Formatting in Salesforce with Example

In this blog, we will explore what Conditional Field Formatting in Salesforce is, its benefits, how to implement it, and provide a business use case to demonstrate its value in action.

It helps the user to better understand their data by visually highlighting important information based on the conditions. It makes it easier to focus on the status of the record and eliminates the need to go through all the details.

To configure this, earlier we have to create a formula field for each custom visual indicator as there’s no way to display the indicator on the field itself. An Idea Exchange Item has already captured so many points due to difficulty in configuring this visual indicator.

So in the winter’25 release, we got the solution as conditional field formatting in Salesforce. Now, we can configure custom visuals which use standard Salesforce Lightning Design System icons. We can directly configure it in the Lighting App Builder via point-and-click.

How to implement it?

Let’s take a business scenario – consider a Sales Opportunity record where the Probability field determines the likelihood of closing a deal. Configure the field to display a green happy face icon for probabilities above 80%, a yellow neutral face icon for probabilities between 50-80%, and a red sad face icon for anything below 50%.

First, we need to make sure that our page will upgraded to dynamic form. So to do that click on any opportunity record, click on the setup icon, and click edit page.

After clicking on the edit page if our page is not upgraded to dynamic form then we will see an option in the right panel in the Record Detail section to upgrade it.

 

Lightning Record Page

 

Click on upgraded now after a pop-up will appear asking which layout we need to refer to or migrate over the dynamic form. We can also configure it from scratch if we want.

Here we have selected Opportunity Layout. After selecting the layout click on finish.

upgrading to dynamic form

 

Upgraded record page

 

Now our record page is ready. So according to the scenario, we have to implement conditional field formatting over the probability field. Click on the Probability Field, on the right panel we have a conditional formatting option where we can create our rule sets.

Conditional Field Formatting

 

Click on the conditional formatting lookup box, there we have the option to create rulesets. We can also select if we have any existing rule sets available.

 

Rule Set box

 

After that, we will get this above ruleset box, where we have to provide the ruleset name and click on next. We have named our ruleset as ProbabilityIndicator.

 

Rule page

 

Then we will have this rule page where we have to provide rule conditions. Here we have selected icon name from list available and then the colour as green as per the condition. Mentioned the condition where probability is greater than or equal to 80%.

 

Multiple rule page

 

When we hit the next button we got the above page where we can add the multiple rules in a single ruleset. So click on the add rule and we will add our next condition where the probability is less than 80% and greater than 50%.

So now we have multiple conditions here in a single rule. Below is the screenshot of how we can add multiple conditions.

 

Multiple second conditions

 

We have chosen to apply formatting when All conditions are met but we also have different options here as mentioned in the screenshot below.

Different condition option

 

Click on Next and similarly, we have added our third rule which is opportunity is below 50%.

Third rule conditon

 

Click on Next and then click on Save Ruleset.

 

 

Save the Record Page if not activated then Activate it and save it again. Navigate to the Details Page. Here our opportunity is below 50% so as per the third rule conditions, a sad face icon in red colour is appearing. If we change the value of our probability then the icon displaying also would change.

 

Detail Page

 

Things to remember while working on conditional field formatting

  1. We can only apply condition field formatting on those fields on objects that support Dynamic Forms.
  2. Lightning Page can only have 15 unique rule sets.
  3. A ruleset can have up to 10 rules.
  4. A rule can have up to 10 conditions.
  5. Rules can be evaluated differently at run time. It depends on the user’s permission to view the record.
  6. We can’t add conditional field formatting to the cross-object field. Also, we can’t select cross-object fields when creating rules.

Are you preparing for the Salesforce AI Certifications? Check out the Salesforce certification practice set here

FAQ’s

1. What are the other ways to view or manage Conditional Field Formatting?

We can view/edit/delete our existing field formatting from the object page we have.

Other way to view formatting

 

2. Can conditional field formatting also be applicable to Salesforce Classic?

No, It is not applicable to classic as it is primarily a Lightning Experience feature. Users in Salesforce Classic would need to migrate to Lightning for access to these capabilities.

3. How is Conditional Field Formatting different from Validation Rules?

While both involve setting conditions, Conditional Field Formatting focuses on changing the visual presentation of data, whereas Validation Rules enforce data integrity by restricting invalid inputs.

4. How can we deploy Ruleset?

While migrating the Record Page the associate Ruleset will also deploy.

Conclusion

Conditional Field Formatting in Salesforce is a powerful tool for enhancing data usability. By highlighting key information based on defined criteria, it enables users to make informed decisions quickly and efficiently.

Get a complete Roadmap To Learn Salesforce Admin And Development

Share Now

Kashish have extensive Salesforce development experience, holding 4 Salesforce certifications. she posses expertise in Apex, Lightning Web Components, and Salesforce Admin, with a track record of successful project delivery. As a dedicated Salesforce enthusiast, she actively seek and embrace new challenges and opportunities within the dynamic Salesforce ecosystem.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *