SOLVED

Sharepoint Conditional Formatting

%3CLINGO-SUB%20id%3D%22lingo-sub-150015%22%20slang%3D%22en-US%22%3ESharepoint%20Conditional%20Formatting%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-150015%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20All%2C%3C%2FP%3E%0A%3CP%3EI%20am%20trying%20to%20find%20Json%20code%20for%20SharePoint%20online%20365%20columns%20in%20a%20custom%20list%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20columnX%20%3D%20%22no%22%20make%20the%20column%20bold%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETIA%2C%3C%2FP%3E%0A%3CP%3EJoe%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-150015%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Esharepoint%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-326543%22%20slang%3D%22en-US%22%3ERe%3A%20Sharepoint%20Conditional%20Formatting%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-326543%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F112203%22%20target%3D%22_blank%22%3E%40matthew%3C%2FA%3E%2C%3C%2FP%3E%3CP%3EThat%20is%20wonderful!!!%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20so%20much%20for%20keeping%20track%20of%20this%20issue%20and%20responding!!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20Agian%2C%3C%2FP%3E%3CP%3EJoe%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-326330%22%20slang%3D%22en-US%22%3ERe%3A%20Sharepoint%20Conditional%20Formatting%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-326330%22%20slang%3D%22en-US%22%3E%3CP%3ERather%20than%20making%20a%20column%20bold%2C%20you%20may%20be%20able%20to%20achieve%20the%20same%20business%20requirement%20and%20draw%20attention%20to%20a%20value%20by%20changing%20the%20background%20color.%20This%20can%20be%20conditional%20set%20based%20on%20the%20value%20on%20a%20record%20(i.e%20Yes%20or%20No).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMore%20recently%2C%20there%20is%20also%20a%20no-code%20solution%20for%20Choice%2C%20Date%2FTime%2C%20and%20Boolean%20column%20types%20that%20does%20not%20require%20knowledge%20of%20complex%20JSON%20to%20assign%20background%20colors.%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwww.technologytobusiness.com%2Fmicrosoft-sharepoint%2Fno-code-column-formatting-sharepoint-online%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3ENo%20Code%20Column%20Formatting%20%E2%80%93%20SharePoint%20Online%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-151217%22%20slang%3D%22en-US%22%3ERe%3A%20RE%3A%20Sharepoint%20Conditional%20Formatting%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-151217%22%20slang%3D%22en-US%22%3EThanks%20I%20will%20see%20what%20else%20I%20can%20play%20with%20%3A)%3C%2Fimg%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-151026%22%20slang%3D%22en-US%22%3ERe%3A%20RE%3A%20Sharepoint%20Conditional%20Formatting%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-151026%22%20slang%3D%22en-US%22%3EGood%20write%20up%20on%20this%20topic%20here%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fdeclarative-customization%2Fcolumn-formatting%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fdeclarative-customization%2Fcolumn-formatting%3C%2FA%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-151025%22%20slang%3D%22en-US%22%3ERe%3A%20RE%3A%20Sharepoint%20Conditional%20Formatting%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-151025%22%20slang%3D%22en-US%22%3Enice%20one!%20Will%20have%20to%20look%20into%20what%20you%20can%20do%20with%20column%20formatting%20a%20little%20more%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-150718%22%20slang%3D%22en-US%22%3ERe%3A%20RE%3A%20Sharepoint%20Conditional%20Formatting%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-150718%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Nigel%2C%3C%2FP%3E%0A%3CP%3EYes%20a%20small%20bit%20of%20Json%20in%20the%20column%20formatting%20does%20the%20trick%20%3A)%3C%2Fimg%3E%3C%2FP%3E%0A%3CP%3EBelow%20is%20an%20example%2C%20%40faustocapellanjr%26nbsp%3Bsent%20me...%3C%2FP%3E%0A%3CP%3EThanks%20again%20for%20your%20help.%3C%2FP%3E%0A%3CP%3EJoe%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%7B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%22%24schema%22%3A%20%22%3CA%20href%3D%22http%3A%2F%2Fcolumnformatting.sharepointpnp.com%2FcolumnFormattingSchema.json%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fcolumnformatting.sharepointpnp.com%2FcolumnFormattingSchema.json%3C%2FA%3E%22%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%22txtContent%22%3A%20%22%40currentField%22%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%22elmType%22%3A%20%22div%22%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%22style%22%3A%20%7B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22font-weight%22%3A%20%7B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22operator%22%3A%20%22%3F%22%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22operands%22%3A%20%5B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22operator%22%3A%20%22%3D%3D%22%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22operands%22%3A%20%5B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22%40currentField%22%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22No%22%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%5D%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22bold%22%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22%22%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%5D%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%7D%3CBR%20%2F%3E%7D%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-150628%22%20slang%3D%22en-US%22%3ERe%3A%20RE%3A%20Sharepoint%20Conditional%20Formatting%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-150628%22%20slang%3D%22en-US%22%3EIt%20might%20be%20possible%20to%20do%20something%20with%20the%20Column%20Formatting%20(Ive%20never%20really%20used%20it)%20but%20the%20Field%20Customizer%20is%20probably%20the%20best%20way%20to%20customize%20the%20rendering%20of%20any%20field%2C%20and%20be%20confident%20that%20it%20will%20work%20in%20Modern%20SharePoint%20pages%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-150041%22%20slang%3D%22en-US%22%3ERe%3A%20RE%3A%20Sharepoint%20Conditional%20Formatting%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-150041%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20Nigel%2C%3C%2FP%3E%0A%3CP%3EI%20will%20look%20into%20that.%26nbsp%3B%20I%20didnt%20expect%20it%20to%20be%20so%20complex.%26nbsp%3B%20I%20figured%20I%20could%20just%20add%20some%20Json%20Code%20in%20the%20coumn%20Formatting%20in%20the%20column%20settings.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThanks%20again%2C%3C%2FP%3E%0A%3CP%3EJoe%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-150036%22%20slang%3D%22en-US%22%3ERE%3A%20Sharepoint%20Conditional%20Formatting%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-150036%22%20slang%3D%22en-US%22%3EHi%2C%20You%20probably%20need%20to%20use%20a%20Field%20Customizer%20for%20this%20(and%20that%20way%20no%20that%20it%20will%20work%20in%20modern%20pages%20as%20well%20as%20classic).%20A%20good%20write-up%20of%20the%20process%20is%20at%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fspfx%2Fextensions%2Fget-started%2Fbuilding-simple-field-customizer%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fspfx%2Fextensions%2Fget-started%2Fbuilding-simple-field-customizer%3C%2FA%3E%20You%20will%20need%20to%20change%20the%20code%20in%20the%20onRenderCell%20to%20check%20for%20your%20%22No%22%20value%20and%20then%20add%20the%20appropriate%20style%20class.%20Cheers%2C%20Nigel%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1336132%22%20slang%3D%22en-US%22%3ERe%3A%20Sharepoint%20Conditional%20Formatting%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1336132%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F108753%22%20target%3D%22_blank%22%3E%40Joe%20Fischer%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%20There...I%20know%20this%20post%20is%20several%20years%20old%3B%20however%2C%20Microsoft%20has%20granted%20your%20wish%20WITHOUT%20JSON%20CODE!%20The%20update%20is%20rolling%20out%20now%20and%20my%20tenant%20just%20got%20it%20last%20week!%20If%20you%20go%20into%20the%20view%20drop%20down%2C%20and%20select%20%22Format%20this%20view%22%20you%20will%20see%202%20options.%20The%202nd%20option%20is%20for%20conditional%20formatting.%20All%20you%20have%20to%20do%20is%20just%20make%20sure%20the%20column%20by%20which%20you%20want%20the%20rule%20to%20run%20is%20showing%20up%20in%20the%20view.%20From%20there%20you%20can%20easily%20say...if%20this%20column%20equals%20%22no%22%20then%20make%20the%20entire%20row%20(or%20a%20particular%20column%20bold%2C%20red%2C%20italicized...whatever).%20Good%20luck%20and%20here%20is%20a%20link%20to%20the%20roadmap%20item%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FMicrosoft-SharePoint-Blog%2FContent-collaboration-throughout-Microsoft-365-Ignite-2019%2Fba-p%2F960868%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FMicrosoft-SharePoint-Blog%2FContent-collaboration-throughout-Microsoft-365-Ignite-2019%2Fba-p%2F960868%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Contributor

Hi All,

I am trying to find Json code for SharePoint online 365 columns in a custom list:

 

If columnX = "no" make the column bold

 

TIA,

Joe

10 Replies
Hi, You probably need to use a Field Customizer for this (and that way no that it will work in modern pages as well as classic). A good write-up of the process is at: https://docs.microsoft.com/en-us/sharepoint/dev/spfx/extensions/get-started/building-simple-field-cu... You will need to change the code in the onRenderCell to check for your "No" value and then add the appropriate style class. Cheers, Nigel

Thanks Nigel,

I will look into that.  I didnt expect it to be so complex.  I figured I could just add some Json Code in the coumn Formatting in the column settings.

 

Thanks again,

Joe

It might be possible to do something with the Column Formatting (Ive never really used it) but the Field Customizer is probably the best way to customize the rendering of any field, and be confident that it will work in Modern SharePoint pages
best response confirmed by Joe Fischer (Contributor)
Solution

Hi Nigel,

Yes a small bit of Json in the column formatting does the trick :)

Below is an example, @faustocapellanjr sent me...

Thanks again for your help.

Joe

 

{
   "$schema": "http://columnformatting.sharepointpnp.com/columnFormattingSchema.json",
   "txtContent": "@currentField",
   "elmType": "div",
   "style": {
       "font-weight": {
           "operator": "?",
           "operands": [
               {
                   "operator": "==",
                   "operands": [
                       "@currentField",
                       "No"
                   ]
               },
               "bold",
               ""
           ]
       }
   }
}

nice one! Will have to look into what you can do with column formatting a little more
Thanks I will see what else I can play with :)

Rather than making a column bold, you may be able to achieve the same business requirement and draw attention to a value by changing the background color. This can be conditional set based on the value on a record (i.e Yes or No).

 

More recently, there is also a no-code solution for Choice, Date/Time, and Boolean column types that does not require knowledge of complex JSON to assign background colors.

No Code Column Formatting – SharePoint Online

Hi @matthew,

That is wonderful!!! 

 

Thank you so much for keeping track of this issue and responding!!

 

Thanks Agian,

Joe

 

 

@Joe Fischer 

 

Hi There...I know this post is several years old; however, Microsoft has granted your wish WITHOUT JSON CODE! The update is rolling out now and my tenant just got it last week! If you go into the view drop down, and select "Format this view" you will see 2 options. The 2nd option is for conditional formatting. All you have to do is just make sure the column by which you want the rule to run is showing up in the view. From there you can easily say...if this column equals "no" then make the entire row (or a particular column bold, red, italicized...whatever). Good luck and here is a link to the roadmap item

 

https://techcommunity.microsoft.com/t5/Microsoft-SharePoint-Blog/Content-collaboration-throughout-Mi...