JSON Formatting

Home Page Forums Office 365 SharePoint JSON Formatting

Tagged: 

This topic contains 0 replies, has 1 voice, and was last updated by  Martin Hulme 1 month ago.

  • Author
    Posts
  • #822

    Martin Hulme
    Participant

    Hi There.

    I’m new to the group today, so thank you for adding me.

    I am trying to use JSON to colour code fields in a Sharepoint List.

    I am not a programmer and have managed to put together a script that partially works, but I am stumped as to how to make it all work.

    I am just looking at the content of a single field for a known string, if it matches then the field box turns the colour defined in the code.

    In the code below, the first 4 operands work but the last one does NOT.
    I have checked the formatting a validated the JSON with availible online tools but for some reason it stops colour coding the fields after the 4th one.

    Any help appreciated.

    {
    “$schema”: “http://columnformatting.sharepointpnp.com/columnFormattingSchema.json”,
    “debugMode”: true,
    “elmType”: “div”,
    “txtContent”: “@currentField”,
    “style”: {
    “color”: “#111”,
    “padding-left”: “14px”,
    “background-color”: {
    “operator”: “?”,
    “operands”: [
    {
    “operator”: “==”,
    “operands”: [
    “@currentField”,
    “PARKED”
    ]
    },
    “#e81123”,

    {
    “operator”: “?”,
    “operands”: [
    {
    “operator”: “==”,
    “operands”: [
    “@currentField”,
    “ONGOING”
    ]
    },
    “#00B294”,
    {
    “operator”: “?”,
    “operands”: [
    {
    “operator”: “==”,
    “operands”: [
    “@currentField”,
    “COMPLETED”
    ]
    },
    “#ff8c00”,
    {
    “operator”: “?”,
    “operands”: [
    {
    “operator”: “==”,
    “operands”: [
    “@currentField”,
    “Chased Client”
    ]
    },
    “#fff100”,
    {
    “operator”: “?”,
    “operands”: [
    {
    “operator”: “==”,
    “operands”: [
    “@currentField”,
    “ISIS MEDIA DELETED”
    ]
    },
    “ab12cd”,
    “”
    ]
    }
    ]
    }
    ]
    }
    ]
    }
    ]
    }
    }
    }

You must be logged in to reply to this topic.