Forum Discussion
Approval Status field to turn red when status is Pending AND file was Modified 30 days ago (or more)
- Feb 06, 2024
lorinda_abey Try using JSON column formatting for your Approval Status column like:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "txtContent": "@currentField", "style": { "color": "=if(@currentField=='Pending' && [$Modified] < addDays(@now,-30),'red','')", "font-weight": "=if(@currentField=='Pending' && [$Modified] < addDays(@now,-30),'bold','')" } }Where [$Modified] is an internal name of your modified date 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?
Output:
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.
lorinda_abey Try using JSON column formatting for your Approval Status column like:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"style": {
"color": "=if(@currentField=='Pending' && [$Modified] < addDays(@now,-30),'red','')",
"font-weight": "=if(@currentField=='Pending' && [$Modified] < addDays(@now,-30),'bold','')"
}
}
Where [$Modified] is an internal name of your modified date 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?
Output:
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.
- lorinda_abeyFeb 07, 2024Copper ContributorThank you. This worked perfectly.
Question... Can you also colour a whole row (rather than just the current field) this way?- ganeshsanapFeb 07, 2024MVP
Yes, but you will have to use the SharePoint "view" formatting with additionalRowClass for that.
Check: SharePoint List layout customizations
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.