additionalRowClass for SharePoint list row formatting doesn't seem to work for me

%3CLINGO-SUB%20id%3D%22lingo-sub-1158358%22%20slang%3D%22en-US%22%3EadditionalRowClass%20for%20SharePoint%20list%20row%20formatting%20doesn't%20seem%20to%20work%20for%20me%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1158358%22%20slang%3D%22en-US%22%3E%3CP%3EHey%20all%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20been%20trying%20for%20some%20time%20to%20get%20the%20list%20row%20color%20formatting%20to%20work.%20I%20have%20a%20SharePoint%20list%20that%20contain%20Employee%20information.%20There%20is%20a%20'Status'%20column%20of%20type%20%22Single%20line%20of%20text%22%20with%20the%20values%20'Active'%20and%20'InActive'.%20I%20have%20been%20attempting%20to%20apply%20the%20following%20JSON%20to%20format%20rows%20based%20on%20'InActive'%20employees%20vs.%20'Active'%20ones%2C%20of%20course%20changing%20the%20column%20name%20to%20my%20own%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJSON%20from%20Microsoft%20Docs%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%7B%0A%20%20%22schema%22%3A%20%22https%3A%2F%2Fdeveloper.microsoft.com%2Fjson-schemas%2Fsp%2Fview-formatting.schema.json%22%2C%0A%20%20%22additionalRowClass%22%3A%20%22%3Dif(%5B%24Status%5D%20%3D%3D%20'Done'%2C%20'sp-field-severity--good'%2C%20if(%5B%24Status%5D%20%3D%3D%20'In%20progress'%2C%20'sp-field-severity--low'%20%2Cif(%5B%24Status%5D%20%3D%3D%20'In%20review'%2C'sp-field-severity--warning'%2C%20if(%5B%24Status%5D%20%3D%3D%20'Blocked'%2C'sp-field-severity--blocked'%2C%20''))))%22%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%3CBR%20%2F%3E%26nbsp%3BMy%20version%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%7B%0A%20%20%22schema%22%3A%20%22https%3A%2F%2Fdeveloper.microsoft.com%2Fjson-schemas%2Fsp%2Fview-formatting.schema.json%22%2C%0A%20%20%22additionalRowClass%22%3A%20%22%3Dif(%5B%24Status%5D%20%3D%3D%20'Active'%2C%20'sp-field-severity--warning'%2C%20if(%5B%24Status%5D%20%3D%3D%20'InActive'%2C%20'sp-field-severity--warning'%2C%20''))%22%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMaybe%20i'm%20missing%20some%20single%20or%20double%20quotes%20somewhere%3F%20When%20I%20click%20the%20'Preview'%20button%2C%20all%20the%20Statuses%20in%20the%20column%20disappears...%20So%20I'm%20not%20entirely%20sure%20what's%20wrong.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20someone%20please%20help%3F%20Thank%20you!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1158358%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1331993%22%20slang%3D%22en-US%22%3ERe%3A%20additionalRowClass%20for%20SharePoint%20list%20row%20formatting%20doesn't%20seem%20to%20work%20for%20me%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1331993%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F421542%22%20target%3D%22_blank%22%3E%40Yarrah%3C%2FA%3E%26nbsp%3BYou%20need%20to%20specify%20also%20a%20cell%20formatting%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%7B%0A%22schema%22%3A%20%22https%3A%2F%2Fdeveloper.microsoft.com%2Fjson-schemas%2Fsp%2Fview-formatting.schema.json%22%2C%0A%22additionalRowClass%22%3A%20%22%3Dif(%5B%24Status%5D%20%3D%3D%20'Active'%2C%20'sp-field-severity--warning'%2C%20if(%5B%24Status%5D%20%3D%3D%20'InActive'%2C%20'sp-field-severity--warning'%2C%20''))%22%2C%0A%22elmType%22%3A%20%22div%22%2C%0A%22txtContent%22%3A%20%22%40currentField%22%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
Highlighted
Contributor

Hey all,

 

I have been trying for some time to get the list row color formatting to work. I have a SharePoint list that contain Employee information. There is a 'Status' column of type "Single line of text" with the values 'Active' and 'InActive'. I have been attempting to apply the following JSON to format rows based on 'InActive' employees vs. 'Active' ones, of course changing the column name to my own:

 

JSON from Microsoft Docs:

{
  "schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
  "additionalRowClass": "=if([$Status] == 'Done', 'sp-field-severity--good', if([$Status] == 'In progress', 'sp-field-severity--low' ,if([$Status] == 'In review','sp-field-severity--warning', if([$Status] == 'Blocked','sp-field-severity--blocked', ''))))"
}


 My version:

{
  "schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
  "additionalRowClass": "=if([$Status] == 'Active', 'sp-field-severity--warning', if([$Status] == 'InActive', 'sp-field-severity--warning', ''))"
}

 

Maybe i'm missing some single or double quotes somewhere? When I click the 'Preview' button, all the Statuses in the column disappears... So I'm not entirely sure what's wrong.

 

Can someone please help? Thank you!

1 Reply
Highlighted

@Yarrah You need to specify also a cell formatting:

{
"schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
"additionalRowClass": "=if([$Status] == 'Active', 'sp-field-severity--warning', if([$Status] == 'InActive', 'sp-field-severity--warning', ''))",
"elmType": "div",
"txtContent": "@currentField"
}