Feb 28 2023 03:07 PM
Hi all,
I've been spinning my wheels on this one. I have created a calendar view from a SP list and want to color code calendar items based on the event type (field = "Event_Type"). They selection list is formatted as radio buttons. I've written the following JSON and input into the Advanced View under Conditional Formatting. I've tried everything I can think of to de-bug but it seems the code is correct? Yet it isn't working:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
"additionalEventClass": {
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$Event_Type]",
"Vacation/Out of Office"
]
},
"=if(@isSelected == true, 'sp-css-color-WhiteFont sp-css-backgroundColor-BgRed' , 'sp-css-backgroundColor-BgDustRose sp-css-color-DustRoseFont')+' sp-field-fontSizeSmall'",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$Event_Type]",
"Training"
]
},
"=if(@isSelected == true, 'sp-css-color-WhiteFont sp-css-backgroundColor-BgGreen' , 'sp-css-backgroundColor-BgMintGreen sp-css-color-MintGreenFont')+' sp-field-fontSizeSmall'",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$Event_Type]",
"Onboarding"
]
},
"=if(@isSelected == true, 'sp-css-color-WhiteFont sp-css-backgroundColor-BgBrown' , 'sp-css-backgroundColor-BgGold sp-css-color-GoldFont')+' sp-field-fontSizeSmall'",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$Event_Type]",
"Holiday"
]
},
"=if(@isSelected == true, 'sp-css-color-WhiteFont sp-css-backgroundColor-BgTeal' , 'sp-css-backgroundColor-BgCyan sp-css-color-CyanFont')+' sp-field-fontSizeSmall'",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$Event_Type]",
"Meeting"
]
},
"=if(@isSelected == true, 'sp-css-color-WhiteFont sp-css-backgroundColor-BgDarkPurple' , 'sp-css-backgroundColor-BgViolet sp-css-color-VioletFont')+' sp-field-fontSizeSmall'",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$Event_Type]",
"Event"
]
},
"=if(@isSelected == true, 'sp-css-color-WhiteFont sp-css-backgroundColor-BgBlue' , 'sp-css-backgroundColor-BgCornflowerBlue sp-css-color-CornflowerBlueFont')+' sp-field-fontSizeSmall'",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$Event_Type]",
"Board"
]
},
"=if(@isSelected == true, 'sp-css-color-WhiteFont sp-css-backgroundColor-BgGray' , 'sp-css-backgroundColor-BgLightGray sp-css-color-LightGrayFont')+' sp-field-fontSizeSmall'",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$Event_Type]",
"Wellness"
]
},
"=if(@isSelected == true, 'sp-css-color-WhiteFont sp-css-backgroundColor-BgDarkGreen' , 'sp-css-backgroundColor-BgSage sp-css-color-SageFont')+' sp-field-fontSizeSmall'",
""
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
}
Feb 28 2023 05:32 PM
@sbontempo587 try this:
Feb 28 2023 11:28 PM - edited Apr 17 2023 04:01 AM
Solution@sbontempo587 Make sure you are using below things correctly:
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs
Mar 01 2023 08:24 AM
Apr 24 2023 03:33 PM
Apr 25 2023 12:44 AM
@sbontempo587 I haven't faced this issue. But, here are some things you can check:
Please consider giving a Like if my post helped you in any way. For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs
Apr 26 2023 09:04 AM
Apr 26 2023 10:49 AM
@sbontempo587 Unfortunately, it is not supported to remove the time from event title shown in calendar view currently.
SharePoint online list calendar view JSON formatting only supports adding additional CSS classes currently. It does not support more customization options using JSON formatting yet.
Please consider giving Like if my post helped you in any way. For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs
Aug 04 2023 04:43 PM
I found that the default "Calendar View" that is created will not include any additional columns (i.e. custom event type) selected. You'll need to go to the List Settings and edit the calendar view using the classic view editor and include the conditional filter field. When you refresh the calendar view, it may popup with an error and you have to reconfigure the "Modern" settings, but then the conditional formatting will work.
Aug 06 2023 09:59 PM
@Edward_Chong Yes, you will have to show/include additional columns you want to use in JSON formatting in SharePoint calendar view.
Anyone looking for the complete steps for this, check my answer given at: Conditional Formatting in Calendar View is not showing a Column
Please consider giving a Like if my post helped you in any way.
Feb 28 2023 11:28 PM - edited Apr 17 2023 04:01 AM
Solution@sbontempo587 Make sure you are using below things correctly:
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs