Forum Discussion

Zeman_176's avatar
Zeman_176
Copper Contributor
Jun 23, 2023
Solved

A date in a sharepoint list is to be automatically coloured red after 2 weeks using conditional form

Hello all, I have created a list with MS Lists in Sharepoint. Our internal processes are recorded there. Employee XY creates a new line and enters his offer number in one column and the date on w...
  • Rob_Elliott's avatar
    Rob_Elliott
    Jun 26, 2023

    Zeman_176 if you're formatting a particular column, click the dropdown next to the the column header, select Column settings -> Format this column.

     

    Your JSON would be similar to the code below although not exactly the same as I haven't looked in detail at what you are trying to do:

     

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
      "elmType": "div",
      "txtContent": "@currentField",
      "style": {
        "background-color": "=if(@currentField < addDays(@now,-7), '#830909', '#409f93')",
        "color": "white",
        "padding-left": "10px"
      }
    }

     

     

     




Resources