SOLVED

Conditional formatting - automatic change of another column

Copper Contributor

Hi there,

 

I have created a Sharepoint list, which is mostly used to monitor insurance policies to make sure they're up to date. I want to conditionally format the following columns: 

 

insurance.png

 

Is there a way to format the 'insurance status' column to automatically change to 'expired' if today's date is after the date input in expiry date? I seem to only be able to do it if the date is today or any other fixed date.

1 Reply
best response confirmed by VI_Migration (Silver Contributor)
Solution

@Jedd_Kulis don't forget this only changes the formatting, it doesn't change the underlying data.

 

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
  "elmType": "div",
  "txtContent": "=if([$InsuranceExpiryDate]>@now, @currentField, 'Expired')",
  "style": {
    "background-color": "=if([$InsuranceExpiryDate] > @now, 'teal', '#c00000')",
    "color": "white"
  }
}

 


ExpiryDate.png

 

Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)

1 best response

Accepted Solutions
best response confirmed by VI_Migration (Silver Contributor)
Solution

@Jedd_Kulis don't forget this only changes the formatting, it doesn't change the underlying data.

 

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
  "elmType": "div",
  "txtContent": "=if([$InsuranceExpiryDate]>@now, @currentField, 'Expired')",
  "style": {
    "background-color": "=if([$InsuranceExpiryDate] > @now, 'teal', '#c00000')",
    "color": "white"
  }
}

 


ExpiryDate.png

 

Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)

View solution in original post