0

I have a document library with a deadline column and a status column. If the deadline expires, the date will be red (see code). Now, additionally, when the task status is closed, the date should turn black again. Activity status is only open and closed. How can i customize the Code? Thank you all!

{

   "elmType": "div",
   "txtContent": "@currentField",
   "style": {
      "color": {
         "operator": "?",
         "operands": [
            {
               "operator": "<=",
               "operands": [
                  "[$Deadline]",
                  "@now"
               ]
            },
            "#ff0000",
            ""
         ]
      }
   }
}

Many Greetings Christian

1 Answer 1

1

Here is the JSON Formatting for your case:

{
  "elmType": "div",
  "txtContent": "@currentField",
  "style": {
    "color": {
      "operator": "?",
      "operands": [
        {
          "operator": "&&",
          "operands": [
            {
              "operator": "!=",
              "operands": [
                "[$Status]",
                "closed"
              ]
            },
            {
              "operator": "<=",
              "operands": [
                "[$Deadline]",
                "@now"
              ]
            }
          ]
        },
        "#ff0000",
        ""
      ]
    }
  }
}

Please mark as answer if it is the desired solution for you.

4
  • Thanks for that Code! sure that this Code works? when i press F5 it have the same "red"-Colour
    – CPTawesome
    Nov 5, 2018 at 14:21
  • that works for textfields but not for a dropdownlist right?!
    – CPTawesome
    Nov 5, 2018 at 14:52
  • It works for dropdown and date both. Nov 5, 2018 at 14:55
  • Check the spelling and case of "closed" with your dropdown options. They should match. And your deadline should be a date column. Only then it will satisfy a condition with @now Nov 5, 2018 at 14:56

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .