Hello there,
I am attempting to re-create the lightning stage path with branching stages. I built a Visualforce table with the bare-bones of these stages, but am running into trouble when I go to add conditional formatting.
When the stage of this custom object is changed, I would like for the cell color to change (reflecting the original stage path salesforce already provides)

Here is my code so far:
Is there a way to add the IF Statement within the style formatting conditional on the stage field?. When I have attempted to add it in, it gives me several different syntax errors.
Any help would be appreciated! :)

  • 2
    welcome to SFSE! Please see How to Ask on getting the most from the Community. Would you be so kind as to show the VF IF markup that you've tried?
    – cropredy
    Commented Nov 16, 2022 at 23:13
  • 1
    Welcome to Salesforce Stack Exchange (SFSE)! Please do not post code (or error text) exclusively as screenshots - it is not as accessible to users who use screen readers or other assistive technology. (Plus it makes it harder for anyone to help if they want to copy your code and put it in a sandbox or code editor.) Instead, copy your code and paste it in the SFSE editor with three backticks (```) above and below it in order to format it as a code block. (Similarly, format error text with a greater than symbol (>) at the beginning to format it as a quote block.)
    – Moonpie
    Commented Nov 17, 2022 at 2:08

1 Answer 1


I would be interested to know exactly what sort of data your are trying to represent.

Having three header rows is fairly non standard. I would argue that depending on the UI that you are trying to construct, perhaps an arrangement of divs might suit you better.

Anyway, to change the style of a particular div, you could do something like:

<th style="{! IF (stageName == 'Closed Won', 'background-color:red;','background-green;')}"></th>

It's been a while since I tried this, but I think you can use regular styles + an evaluated style like this:

<th style="text-align:center; font-size: 20px; {! IF (stageName == 'Closed Won', ' background-color:red; ',' background-green; ')}"></th>

stageName is of course a property on the controller that you'd need to declare.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .