Conditional Formatting not working in SP List

Sue Downer 96 Reputation points
2021-04-21T08:07:22.81+00:00

Morning Community, I have a calculated field in my list which will show either a score (number) or FAIL when Compliance column = No. I'm trying to get the column to display as red when it is a FAIL (with a warning icon), else show a tick and the score.

My code below has the scores showing correctly, though the FAIL ended up with a tick and the word became invisible.

89854-fail.png

Help ... TIA

{

"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",

"elmType": "div",

"attributes": {

"class": "=if(@currentField == 'FAIL', 'sp-field-total--severeWarning', 'sp-field-total--good') + ' ms-fontColor-neutralSecondary'"  

},

"children": [

{  

  "elmType": "span",  

  "style": {  

    "display": "inline-block",  

    "padding": "0 4px"  

  },  

  "attributes": {  

    "iconName": "=if(@currentField == 'FAIL', ' ErrorBadge', 'CheckMark')"  

  }  

},  

{  

  "elmType": "span",  

  "txtContent": "@currentField"  

}  

]

}

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
6,078 questions
No comments
{count} votes

Accepted answer
  1. Sue Downer 96 Reputation points
    2021-04-21T08:24:45.073+00:00

    Hi Forum - removing this post ... looked at a number of other answers (after posting :( ) and have chosen to use the built-in conditional formatting instead (which meets my purpose)


0 additional answers

Sort by: Most helpful