Forum Discussion
Conditional Formatting in Sharepoint List based on expiry date within 30 days
RobElliott This will work for particular field. But can you please help me with if we want it to be applied to whole view?
AmarTrivedi You can use SharePoint JSON view formatting for your requirements. Use JSON like:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
"additionalRowClass": "=if(Number([$MyDateColumn]) == 0, '', if([$MyDateColumn] <= addDays(@now, 30), 'sp-field-severity--blocked', if([$MyDateColumn] > addDays(@now, 30) && [$MyDateColumn] < addDays(@now, 60), 'sp-field-severity--low', 'sp-field-severity--good')))"
}
Where [$MyDateColumn] is an internal name of your date & time column in SharePoint list in this format: [$InternalNameOfColumn]. You can get the internal name of your SharePoint list columns by following this article: How to find the Internal name of columns in SharePoint Online?
Also, you can change the classes like sp-field-severity--blocked in above JSON as per your requirements. You can find some useful classes at (Thanks to Denis Molodtsov😞 SharePoint Online CSS Classes
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.