Formula to conditionally color V2 calendar event source

What's the formula format to color v2 calendar as "result of template"?

Looking for the ability to vary color based on owner ID

If({{OwnerId}}=xxxxxxxxxxxxxxx, #32a852, IF{{OwnerId}}=yyyyyyyyyyyyyyyyyyyy, #32a852, ...

Best Answer

  • Rob Hatch
    Rob Hatch 🛠️ 
    Accepted Answer

    The template can just call a UI only field on your calendar model. I'd recommend using a a Case Function in that UI Only formula field.

    Read the docs about Case Function here.

    https://docs.skuid.com/latest/en/skuid/formula-function.html#text-manipulation-and-analysis

    The formula might look like this.

    CASE(
      {{OwnerId}},
      "Id1", "Color1",
      "Id2", "Color2",
      "Color3")
    

    The last value is the default value in case none of the user values are found.

    The Color can be Hex, or an named html color value


    WARNING: This solution will be fragile and will require you to edit the skuid page every time you have a new team member who needs a special color. I'd recommend adding a custom field to user object. (with a default value). This "User Color" field could be included in your skuid model for the calendar and would be used in that template.

Answers

  • Allison
    Allison ✭✭✭

    Worked perfectly, thanks Rob.


    Separate but related note, is there a way to hide the times at the top of the calendar entries on Week view? I changed the Event template but it still shows the time regardless of the entry there.


  • Matt Brown
    Matt Brown 🛠️ 

    Hi Allison! I work a good bit on the calendar as PM, so this is good feedback - it looks like removing the times is not currently supported, but that could be an enhancement in a future release. I'll make a note. If you've got a minute, could you give some of the reasoning as to why you'd like to remove the time labels?

  • Allison
    Allison ✭✭✭

    @Matt Brown - Does DSS Calendar-Event-Font size control the font size for the calendar events ("boot camp" in my screenshot above)? I've adjusted the size here but it doesn't seem to impact live calendar?

  • Matt Brown
    Matt Brown 🛠️ 

    @Allison It should, but it looks like this is a bug. I've repro'd in an internal environment and will work with our engineering team to get it fixed. Thank you!

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!