SOLVED

Approval Status Column Suddenly Numeric - Due to Column Formatting?

Brass Contributor

I'm working in my tenant and noticed an issue with all of my lists that have content approval turned on. The approval status column now lists a number instead of the words "Approved" | "Rejected" | "Pending" I see 0 | 1 | 2.


I've created a new list and the words show up fine... but as soon as I turn on column formatting the words turn to numbers...

 

Screenshot 2021-11-05 144956.png

20 Replies

@Jeff_Lacarte Are you applying JSON formatting on Approval status column?

If yes, this is the reason column showing values differently because SharePoint saves approval status column values based on the SPModerationStatusType Enum.

 

Can you show us the JSON code you are using to format list/column?


Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

I was using JSON formatting yes, and it was working fine all week. It seems to have changed on me suddenly. The screenshot in provided is from a brand new list that had no formatting applied. I turned on column formatting and as soon as I did that even without creating a rule the enum shows it's value instead of it's text. Below is a gif of reproducing the issue on a brand new list. Sorry, it's fast, I wanted to keep the size down.

 

approval col formatting issue.gif

Fixed it with a workaround, but it's still an issue. I can't be expected to use a workaround for every list that I need to apply conditional formatting to the approval status column.

 

By going into advanced mode to work with the formatting JSON directly I could see:

 

"txtContent": "[$_ModerationStatus]"

 

 
which is displays the value for a given item in a row of the column.
 
Through trial and error and referencing the syntax reference, I found that you can use '@currentField', which also displayed the numeric value of the approval status. However, once I added '.displayValue' the text value showed up again!

 

"txtContent": "@currentField.displayValue"

 

As for why this happened? I have no idea. This is a workaround for now.

 

This problem suddenly started for me today on all libraries where there is formatting on the Approval Status column.  The problem is not resolved by turning off the column formatting.  When I turn off the column formatting, now instead of a number the Approval Status column is blank.  I had to go then into the Advanced link and delete the json code, which should already disappear when I turned off the column formatting. I don't see any other info on this issue except for your post, but surely this must be occurring due to some Microsoft change. (My Approval Status columns have been formatted for over a year and I have made no recent changes to my site or libraries.)  @Jeff_Lacarte 

@TonieB Thank you for confirming that you have the same problem. I suspected it might have been a MS change behind the scenes.

 

I encourage others to try testing a new list with content approval turned on and try adding column formatting on the Approval Status column. I suspect you will have the same results as TonieB and I. It would be helpful too if others post their results here.

 

TonieB, if your JSON formatting isn't terribly complex, I would try copying it into an editor like VS Code and do a find and replace on: [$_ModerationStatus] to @currentField.displayValue. That should at least get you back up and running as a workaround for now.

I also have the exact same problem. I've had the formatting set on the approval status column for a couple of months. Suddenly it is showing the numeric value just as you describe. I have custom JSON formatting applied as well. Even stranger, it seems to occasionally revert back to the written status. I randomly refreshed my browser and it was back to normal followed by another refresh back to numeric value. This must be something MSFT did.
We are experiencing the same problem. We have had conditional formatting on for about 6 months without a problem. All libraries with the approval status column have the same problem.
The same issue identified!
Thanks @Jeff_Lacarte for workaround!
Hello,

We are experiencing this issue as well. Thank you!
The same problem has appeared on all my sites this week, where I had already implemented a JSON code that has been working for years and nothing similar has ever happened. I hope MS looks for a patch ASAP because this type of bugs does not look good in collaboration systems

Same issue for us. We changed the json formatting to refer to "ModerationStatus" instead and this looks ok. HOWEVER when a search term is entered, all results are showing "Rejected" instead of their true status. Microsoft, fix it please!

Noted the same issue with all Lists in SP Online where conditional formatting was applied based on the approval value

@Jeff_Lacarte 

We have the same issue with impact to the whole list.

The Approval Status formatting was used in our lists also for the other columns in the same list, however, the formatting is not working with the number "0" and also not for the word "Approved".

It is really a pity because it was really nice and simple feature to see the approval status in the first column. I hope that @Pernille-Eskebo  will solve this issue.

Had the same issue at a customer. This is actually a good change because you don't have to check the approval status value for multiple languages anymore (if this is necessary for you). I hope it does not get reverted.
Giving you access to the enumeration value is a good change sure, but changing the returned value of an existing variable is not. People have built custom views around this, and to change it is not ok.
best response confirmed by Jeff_Lacarte (Brass Contributor)
Solution

@Jeff_Lacarte @nfsg20 @DavidLang @Amiryunus @Stephen Bayliss @aricornish @YeBuu @mcancela @Duncan2450 @Gavin Tully @TonieB 

 

This is happening because of recent change in JSON schema to officially support Approval Status column in JSON formatting.

Due to this update, the @currentField and [$_ModerationStatus] will resolve to internal code (enum value) and @currentField.displayValue and [$_ModerationStatus.displayValue] will resolve to the localized string (I guess according to language).

 

The Microsoft official docs will be updated with more info in the coming weeks. You can check the details for now at: SharePoint Online Column Formatting for Approval Status: uses language specific text? 

Related ReadHow to find the Internal name of columns in SharePoint Online? 


Please consider giving a Like if my post helped you in any way. For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs

So . . . are you saying formatting was broken intentionally, without letting anyone know ahead of time, in order to customize that column to add a feature one person asked for? And Microsoft is going to update everyone with info several weeks after the formatting was broken for anyone who had formatting on that column?? So that anyone using SharePoint with formatting on that column will be wondering for weeks on end what the issue is, unless they stumble upon this post thread???

@ganeshsanap thanks for the info and finding this. Further to @TonieB 's comments, the wording of the change makes it seem like it only affects those who elected to use a specific field in custom JSON formatting for a very specific purpose. However the fact is this breaks Out-of-the-box formatting found in SharePoint; the field that was changed is the field that was used by OOB formatting and thus the field that everyone used to further customize if they used their own JSON formatting. Because it's what was used internally! 

 

Here is an example: as soon as you turn on Conditional formatting you can see the approval status immediately change to the number '2'. This is OOB behavior, no custom formatting  in place. They've broken their own code with this change.

built-in-formatting-tool.png

1 best response

Accepted Solutions
best response confirmed by Jeff_Lacarte (Brass Contributor)
Solution

@Jeff_Lacarte @nfsg20 @DavidLang @Amiryunus @Stephen Bayliss @aricornish @YeBuu @mcancela @Duncan2450 @Gavin Tully @TonieB 

 

This is happening because of recent change in JSON schema to officially support Approval Status column in JSON formatting.

Due to this update, the @currentField and [$_ModerationStatus] will resolve to internal code (enum value) and @currentField.displayValue and [$_ModerationStatus.displayValue] will resolve to the localized string (I guess according to language).

 

The Microsoft official docs will be updated with more info in the coming weeks. You can check the details for now at: SharePoint Online Column Formatting for Approval Status: uses language specific text? 

Related ReadHow to find the Internal name of columns in SharePoint Online? 


Please consider giving a Like if my post helped you in any way. For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs

View solution in original post