top of page

Tony's Top Tips: Advanced Color-Coding for SharePoint Lists

Writer's picture: Tony OgilvieTony Ogilvie

SharePoint lists are great! They are brilliant for many users, allowing much better storage of structured data than Excel spreadsheets.


You can also do simple color coding on SharePoint lists based on simple field values. But a common request I hear from customers is:


How do we color-code the list based on a date column in the SharePoint list?

So for example, if a To Do list in SharePoint has a field called "Due Date", how can we color code it so that rows are green if the due date is more than 30 days away, yellow if the due date is within 30 days, and red if the due date is in the past?


It's not at all clear how to do this in the SharePoint View formatting screen, but luckily there is a way to do it!


See how in this little video, and see below for the code snippet used. Slightly tricky, but easy when you know how! 🤓




Format View JSON - this is the code used in the video
{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
  "additionalRowClass": "=if([$DueDate] >= @now + 2592000000, 'sp-field-severity--good', if([$DueDate] >= @now, 'sp-field-severity--warning', 'sp-field-severity--blocked'))"
} 

Before - our To Do List looks boring and grey!

After - our To Do List has colour! We can now see what tasks are overdue and coming up at a glance!

46 views0 comments

댓글


Otagem Logo Wider.png
Microsoft 365 Logo.png
SharePoint.png
Teams.png
PowerApps.png
PowerAutomate.png

© Otagem Consulting Limited 2014 - 2024

bottom of page