Forum Discussion
Alan Trafford
Feb 01, 2018Brass Contributor
Column formatting using JSON
Hi
I'm trying to format a column based on a column containing certain text. This column can have multiple values starting with: "On Hold". Example: "On Hold - Awaiting customer" or "On Hold - A...
Asif Shaik
Mar 08, 2019Copper Contributor
My answer is late, but may be it could help others looking for similar solution.
We can use indexOf operator to check if string contains a particular substring.
Eg.
"txtContent": "=if(indexOf([$Status], 'On Hold') >= 0, 'On Hold', 'Released')"Or something like this:
"background-color": "=if(indexOf([$Status], 'On Hold') >= 0, 'Yellow', 'Green')"
Check the syntax once again if it is not working.
For more details:
https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting