Use JSON Formatting to Highlight Overdue Items: Practical Checklist for SharePoint Owners
🔍 WiseChecker

Use JSON Formatting to Highlight Overdue Items: Practical Checklist for SharePoint Owners

As a SharePoint site owner, you manage lists with due dates and need to quickly identify overdue items at a glance. Standard list views show dates but do not provide visual cues for deadlines that have passed. JSON formatting lets you apply conditional color rules to rows or columns so overdue items stand out with a red background or bold text. This article explains how to use JSON formatting to highlight overdue items in SharePoint lists and provides a practical checklist for site owners.

Key Takeaways: JSON Formatting for Overdue Highlighting

  • Column formatting > @currentField: Applies a red background to a date column when the value is less than @now.
  • Row formatting > if statement: Changes the entire row to red when the due date column is in the past.
  • SharePoint list settings > Format current view: Entry point for applying JSON formatting to rows or columns.

ADVERTISEMENT

What JSON Formatting Does for Overdue Items

JSON formatting is a feature in SharePoint lists and libraries that lets you change the appearance of columns or rows based on rules you write in JSON code. When you target a date column, you can compare each cell value against the current date and time using the @now token. If the due date is earlier than @now, the formatting applies a red fill, red text, or an icon. This works in both modern SharePoint and Microsoft Lists.

Before you write JSON formatting, confirm your list has a date column named something like “Due Date” or “Deadline.” You also need edit permissions on the list, which site owners have by default. JSON formatting does not require custom code deployment or SharePoint Framework solutions. You paste the JSON directly into the formatting pane in the list settings.

There are two approaches. Column formatting changes only the cell that contains the date. Row formatting changes the entire row, which makes overdue items visible even when you scroll horizontally. Both methods use the same JSON structure but target different scopes.

Steps to Apply JSON Formatting for Overdue Highlighting

Follow these steps to add JSON formatting that highlights overdue items in a SharePoint list. The example uses a column named “Due Date” with the Date and Time type.

  1. Open the list and go to column settings
    Navigate to your SharePoint list. Click the column header for the date column you want to format. Select Column settings then Format this column.
  2. Paste the JSON code for column formatting
    In the Format column pane, select Advanced mode. Delete the default code and paste the following JSON:

    {
    "$schema": "http://columnformatting.sharepointpnp.com/columnFormattingSchema.json",
    "elmType": "div",
    "txtContent": "@currentField",
    "style": {
    "background-color": "=if(@currentField < @now, 'red', 'transparent')",
    "color": "=if(@currentField < @now, 'white', 'inherit')",
    "font-weight": "=if(@currentField < @now, 'bold', 'normal')"
    }
    }

    This code checks if the date value in the cell is earlier than the current date. If yes, the cell gets a red background, white text, and bold font. If not, the cell keeps its default appearance.

  3. Click Save to apply the formatting
    Click the Save button at the bottom of the pane. The list view refreshes and overdue dates appear with a red background.
  4. Apply row formatting for full-row highlighting (optional)
    To highlight the entire row, go back to the list. Click the down arrow next to the list name and select List settings. Under Views, click the current view name. Scroll to the Format view section and paste the following JSON into the Row formatting box:

    {
    "$schema": "http://columnformatting.sharepointpnp.com/columnFormattingSchema.json",
    "elmType": "div",
    "style": {
    "background-color": "=if([$DueDate] < @now, 'lightcoral', 'transparent')"
    },
    "children": [
    {
    "elmType": "div",
    "style": {
    "box-sizing": "border-box",
    "padding": "0 12px"
    },
    "txtContent": "=[$Title]"
    }
    ]
    }

    Replace [$DueDate] with the internal name of your date column. Click OK to save the view.

ADVERTISEMENT

Common Mistakes When Using JSON for Overdue Highlighting

Overdue items are not highlighted after I paste the JSON

The most common cause is a mismatch between the column name in the JSON and the actual internal name of the date column. In row formatting, the column reference must use the internal name, not the display name. To find the internal name, go to List settings, click the column name, and look at the URL for the Field parameter. For example, if the URL contains Field=Due_x0020_Date, use [$Due_x0020_Date] in the JSON.

The date comparison does not account for time zones

The @now token uses Coordinated Universal Time (UTC). If your list users are in a time zone behind UTC, an item due at 11:00 PM local time might appear overdue before midnight because UTC has already advanced to the next day. To avoid this, add a condition that also checks for time, or use a calculated column that stores the due date in UTC. A simpler workaround is to set the due date to the end of the business day instead of midnight.

Row formatting breaks the list view layout

If the JSON for row formatting does not include all columns or uses incorrect elmType values, the row may display incorrectly. Always test row formatting on a small list first. Start with a simple JSON that only changes the background color and add more columns gradually.

Column Formatting vs Row Formatting: When to Use Each

Item Column Formatting Row Formatting
Scope Only the date cell Entire row
Complexity Simple, one condition Requires column references
Best for Quick visual cue in a single column Making overdue items visible when scrolling
Performance Faster on large lists Slightly slower on very large lists

Column formatting is easier to set up and works well when your list has few columns. Row formatting is better when you want the entire row to stand out, especially in lists with many columns where the date column may scroll off the screen.

After applying JSON formatting, test the view by adding a few items with past due dates. If the highlighting does not appear, refresh the page and check the JSON syntax for missing commas or brackets. You can also use the Preview button in the formatting pane to see the result before saving.

For advanced scenarios, combine multiple conditions in the JSON. For example, highlight items that are overdue by more than seven days with a darker red, and items due today with yellow. Use nested if statements or the && operator in the JSON to create these rules.

SharePoint site owners should also consider creating a view that filters overdue items automatically. Go to the view settings and add a filter where the due date column is less than or equal to [Today]. This gives you a dedicated view of overdue items without relying solely on color formatting.

ADVERTISEMENT