Conditional Formatting in Salesforce Lightning: Dynamic Highlighting on Record Pages

Quick guide: Use Lightning conditional formatting and the Dynamic Highlight Panel to color-code fields (like Case Number) based on record values — improving agent triage and visibility.

What is Conditional Formatting in Lightning?

Conditional formatting lets you assign icons and colors to field values so they appear, disappear, or change based on rules you define. These rules are configured at the object level and can be applied to fields on Lightning record pages — most commonly via the Dynamic Highlight Panel or a Highlight Panel component.

Business example

Imagine service agents scanning Cases. You want Case Number to stand out by color depending on the Census Type and an additional flag (NOMNC):

  • Discharge → Red
  • Admission → Green
  • Continued Stay + NOMNC = Yes → Blue
  • Continued Stay + NOMNC = No → Purple

How to configure Conditional Formatting

Follow these steps to set up conditional formatting on a Lightning record page:

  • Open the Lightning Record Page (e.g., Case Record Page) you want to modify in the Lightning App Builder.
  • Select the field you want to highlight (for example, Case Number) in the page editor.
  • On the right-hand properties pane look for the Conditional Formatting dropdown. Salesforce shows rules tied to the object there. If no rules exist, use the plus (+) icon to create a new rule.
  • Create rules: each rule can include one icon and one color. Add multiple conditions under a single rule when needed (for example, rule for Continued Stay with NOMNC = Yes).
  • Save the rule(s). Then in the Dynamic Highlight Panel or the Highlight Panel component, select the same field and choose the conditional formatting rule you created.

Notes and best practices

  • Conditional formatting rules are created per object and can be applied to any field of that same object.
  • You can add several icon styles (not limited to stars) and choose colors that align with your team’s visual language.
  • Test rules in a sandbox or staging page to confirm behavior across record variations and profile visibility.
  • Keep color usage consistent and accessible — ensure contrast so users with color vision differences can still distinguish status (consider adding icons in addition to color).

Where to learn more

Salesforce documentation has additional considerations and limitations for conditional formatting: Conditional Formatting considerations.

Why this matters for Salesforce teams

Conditional formatting speeds up visual triage for service agents, highlights high-priority records at a glance, and reduces time spent opening records to find status details. For admins and developers, it’s a low-code way to increase UI clarity and drive faster, more accurate decisions across CRM workflows.

Use cases include support queues, risk/incident tracking, admissions/discharge workflows, and any scenario where quick visual cues reduce cognitive load for users.