SP List column conditional formatting not working

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.

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"

    }

  ]

}

Hi Sue,

 

Thank you for posting your question in this community. Based on your description and coding you shared, you are using the JSON code to customize the conditional formatting in the column based on the data entry. But the data

 

Because this forum we are majorly focusing on the built-in feature in SharePoint Online. For the JSON code, I suggest you can raise this question in Microsoft Q&A forum with SharePoint Online and SharePoint customization tag, which the related team can provide more professional suggestion and diagnose the JSON code you used in your conditional formatting.

 

Sorry for the inconvenience caused. Appreciate your understanding.

 

Best regards,

Dihao

-----------------------
* Beware of scammers posting fake support numbers here.
* Kindly Mark and Vote this reply if it helps, as it will be beneficial to more community members reading here.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Thanks Dihao - apologies for posting in wrong forum.  Have reposted as you suggested

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated September 30, 2021 Views 180 Applies to: