I have the following list view :-

enter image description here

now i am trying to change the color of the Breaks field to be Red in-case the Engineer field has value, while make it Green if the engineer field is empty.. can anyone advice ?


1 Answer 1


You can try the following JSON for [Breaks]:

  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "txtContent": "@currentField",
  "style": {
    "background-color": "=if([$Engineer]=='', 'Green', 'Red')",
    "color": "black",
    "font-size": "1.0em",
    "justify-content": "center"

enter image description here

  • thanks it worked
    – John John
    Feb 26, 2021 at 22:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.