Forum Discussion

MalloryCA's avatar
MalloryCA
Copper Contributor
Oct 18, 2024

My JSON won't work for column formatting to color code the calendar on my MS Teams SharePoint Site

I would like to color code the calendar events based on choices for the “Source” category column, and I understand you can do this by going into List Settings<(Column name) <Column Formatting. I used chatGBT to create a JSON, but for some reason my events are still all black. I've included the JSON below. All the other column formatting questions that I have seen online look much different, so I've also attached a screenshot of the “Edit column” page for the column I would like to add conditional formatting to change the color of the event boxes.

 

{ "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json", "elmType": "div", "style": { "background-color": "=if(@currentField == 'Enterprise Forums', '#F5A623', if(@currentField == 'G&G Routines', '#4A90E2', if(@currentField == 'Finance/HR', '#50E3C2', if(@currentField == 'Strategy', '#B8E986', '#FFFFFF'))))", "color": "#000000", "padding": "5px" }, "children": [ { "elmType": "span", "txtContent": "@currentField" } ] }

 

No RepliesBe the first to reply

Resources