Forum Discussion

Tanya Denton's avatar
Tanya Denton
Steel Contributor
Mar 27, 2019
Solved

Approval Status Column Formatting - gone!

I may be having a senior moment, but the column formatting on a document library with Approval Status switched on has disappeared. It was there the other day but looking at it now it looks like this

I presume I used the view format, as when I tried to reapply the format using column format the option is not there on this column (it is on all the other columns in the library).  The view format is now empty - really confused - anyone out there experiencing the same problem or can point me in the right direction pretty please?

42 Replies

  • Tanya Denton 

     

    I have fixed the issue by using this JSON:

     

    {
    "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
    "elmType": "div",
    "attributes": {
    "class": "=if([$_ModerationStatus] == 0, 'sp-field-severity--good', if([$_ModerationStatus] == 2, 'sp-field-severity--warning', if([$_ModerationStatus] == 1, 'sp-field-severity--severeWarning', 'sp-field-severity--blocked'))) + ' ms-fontColor-neutralSecondary'"
    },
    "children": [
    {
    "elmType": "span",
    "style": {
    "display": "inline-block",
    "padding": "0 4px"
    },
    "attributes": {
    "iconName": "=if([$_ModerationStatus] == 0, 'CheckMark', if([$_ModerationStatus] == 2, 'Error', if([$_ModerationStatus] == 1, 'Warning', 'ErrorBadge')))"
    }
    },
    {
    "elmType": "span",
    "txtContent": "=if([$_ModerationStatus] == 0, 'Approved', if([$_ModerationStatus] == 2, 'Pending', if([$_ModerationStatus] == 1, 'Warning', 'Rejected')))"
    }
    ]
    }

     

  • ikoalosaurus's avatar
    ikoalosaurus
    Copper Contributor

    Tanya Denton 

    Hello Tanya,

    could you please share the code needed to have the column approval status display different colors for different values (it's an automatic column created in the library which i use for approval workflow) ? 

    Thank you : )

    • Tanya Denton's avatar
      Tanya Denton
      Steel Contributor

      ikoalosaurus 

       

      {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
      "elmType": "div",
      "attributes": {
      "class": "=if(@currentField == 'Approved', 'sp-field-severity--good', if(@currentField == 'Pending', 'sp-field-severity--low', if(@currentField == 'Draft', 'sp-field-severity--warning', if(@currentField == 'Rejected', 'sp-field-severity--severeWarning', 'sp-field-severity--blocked')))) + ' ms-fontColor-neutralSecondary'"
      },
      "children": [
      {
      "elmType": "span",
      "style": {
      "display": "inline-block",
      "padding": "0 4px"
      },
      "attributes": {
      "iconName": "=if(@currentField == 'Approved', 'CheckMark', if(@currentField == 'Pending', 'Forward', if(@currentField == 'Draft', 'Error', if(@currentField == 'Rejected', 'Warning', 'ErrorBadge'))))"
      }
      },
      {
      "elmType": "span",
      "txtContent": "@currentField"
      }
      ]
      }

  • nz_archer's avatar
    nz_archer
    Copper Contributor

    Hi Tanya Denton 

     

    I am having the exact same issue.

     

    This was how my Approval Status column was before:

    And this is how it is now:

    This is very frustrating I hope it gets fixed soon

  • Hi Tanya Denton,

     

    If you share the JSON I am happy to test for you. I have a number of lists with custom formatting and they are all behaving as expected.

     

    Norm

    • Tanya Denton's avatar
      Tanya Denton
      Steel Contributor
      @Norman thanks for such a quick reply. My problem is the JSON has gone (if it was there in the first place) in the Format VIEW, and there is no option on the Approval Status column to add a column format. This is why i am confused!
      • Norman Young's avatar
        Norman Young
        MVP

        My custom JSON is working and so are my "Format Status column" settings.

        Did the choice values happen to change?

         

        Is there any JSON code listed in the list settings > edit column?

         

         

Resources