JSoN Conditional Formatting to highlight a Row as red if it is beyond 3 days and to not put any highlight if within 3 days

Treb Bert 40 Reputation points
2024-04-30T08:44:03.55+00:00

Hi,

I need help to use JSON conditional format to highlight a particular date as red if it is already beyond 3 days from the current date. For example, date in that particular row is 4/30/2024 and it will be highlighted as red when May 3 comes(so on and so forth), will be highlighted as red. Also, it should exclude weekends in the process. Row name is Process Date.

And to not have any highlight once date is closed in time or within 2 days. The closed date column is in a different column

Thank you so much for helping. I'm having a hard time finding solutions online.

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,822 questions
{count} votes

Accepted answer
  1. Haoyan Xue_MSFT 20,591 Reputation points Microsoft Vendor
    2024-05-01T09:26:36.69+00:00

    Hi @Treb Bert ,

    Thank you for posting in this community.

    First create a calculated column(named CALweekday in my case) to calculate the 3-day expiration date excluding weekends.

    =IF(WEEKDAY([Process Date])=2,[Process Date]+3,(IF(WEEKDAY([Process Date])=3,[Process Date]+3,(IF(WEEKDAY([Process Date])=1,[Process Date]+3+1,[Process Date]+3+2)))))
    

    User's image

    User's image

    Then use the following JSoN Conditional Formatting code:

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
      "additionalRowClass": "=if([$ClosedDate],if([$ClosedDate] >= [$CALweekday],'sp-field-severity--severeWarning',''),if([$CALweekday] <= @now,'sp-field-severity--severeWarning','')) || if(([$ClosedDate] >= [$CALweekday]), 'sp-field-severity--severeWarning', '')"
    }
    

    Output:

    User's image


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful