Background Color the events on calendar based on a picklist value

  • 1
  • Problem
  • Updated 10 months ago
Usecase: I would like to update the background of an event based on a picklist value.  

If the picklist values is any of these  then :green else blue
Corp - Workday Rising US

Corp - Elevate US


Corp - Exec Programs

Corp - Tradeshows

I tried the formula for background color but this only show the first color:
if({{Campaign_Channel__c}} =
"Corp - Workday Rising US", "#ff9b69"),
if({{Campaign_Channel__c}} =
"Corp - Elevate US",  "40a0ff","#217a37")
Photo of Jaiti

Jaiti

  • 412 Points 250 badge 2x thumb

Posted 10 months ago

  • 1
Photo of Mike Dwyer

Mike Dwyer, Champion

  • 4,736 Points 4k badge 2x thumb
What your code says is to use orange for Corp - Workday Rising US, blue for Corp - Elevate US, and green for anything else. The specs are not the same.

Is the formula in a UI-Only field in the model used as the Event Source on your calendar? Is that field used in the Background Color property on the Event Display tab for the Event Source?

Your code does have a syntax error as a ui-only field formula:  the first close-parentheses, after ff9b69", should be at the end, after 217a37"). The format is:

if ( a, then,
 if ( b, then, else )
)

The way I read your specs, you could code the formula as 

if ( {{Campaign_Channel__c}} = "Corp - Workday Rising US"
  || {{Campaign_Channel__c}} = "Corp - Elevate US"
  || {{Campaign_Channel__c}} = "Corp - Exec Programs"
  || {{Campaign_Channel__c}} = "Corp - Tradeshows",
"#217a37",
"#40a0ff")

(Also, your 'blue' value 40a0ff needs a # in front of it.)

Photo of Zach McElrath

Zach McElrath, Employee

  • 55,248 Points 50k badge 2x thumb
I think your Formula is invalid, try this instead:

IF({{Campaign_Channel__c}} = "Corp - Workday Rising US", "#ff9b69",
IF({{Campaign_Channel__c}} = "Corp - Elevate US", "#40a0ff","#217a37"))