Is it possible to render calendar source background color according to a condition?

edited February 17, 2020 in Questions
If a certain field in the event source is blank render a different color. i.e. In event display and background color settings in calendar source properties:
imageif {{AccountId}} isBlankValue thenย #FFFF00 else #00000

?
Thanks.

Comments

  • Zach McElrathZach McElrath Principal Software Engineer Chattanooga, TN ๐Ÿ’Ž๐Ÿ’Ž๐Ÿ’Ž
    edited July 15, 2017
    I think you can do this with Mustache merge syntax, yes, but the easiest way to do this would be to define a Formula Field, and then have your Background Color be determined by the Formula Field, e.g.

    Background Color: {{CalendarColor__c}}

    Where CalendarColor__c is a Formula Field you define in Salesforce, whose output is a Color, e.g.ย 

    IF(ISBLANK(AccountId),"#FFFF00","#000000")


  • edited February 17, 2020
    Thanks Zach.. This opens up so many possibilities. I feel like Picasso on a blank page LOL
  • pocpoc
    edited July 14, 2017
    Would you please show us how to show it within merge syntax without bothering formular field? Thanks
  • Zach McElrathZach McElrath Principal Software Engineer Chattanooga, TN ๐Ÿ’Ž๐Ÿ’Ž๐Ÿ’Ž
    edited July 15, 2017
    Sure, you can do it with merge syntax but I would highly recommend adding a Ui-Only Formula Field on the Model (NOT a Salesforce Formula Field) rather than using merge syntax, as it's much cleaner and more understandable.

    Ui-Only Formula Field approach:

    Background Color: {{CalendarColor__ui}}

    Where CalendarColor__ui is a Ui-Only Formula Field in the Model whose value isย IF(ISBLANK(AccountId),"#FFFF00","#000000")

    Merge Syntax approach:

    Background Color: {{#AccountId}}#FFFF00{{/AccountId}}{{^AccountId}}lightgreen{{/AccountId}}

    Translation: If we have an AccountId, color is #FFFF00, otherwise #000000

    Either of these hard-coded values (e.g. #FFFF00 or lightgreen) can be substituted for a dynamic field value, e.g. {{CalendarColor__c}}
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!