Apr 08 2020 12:33 PM
Hi!
Can I format a list field using a field extension based on a given logic from multiple fields on a row?
Let's assume, I have a list with 3 columns:
Enddate | Status | Traffic light |
1/4/2020 | Done | Green |
2/4/2020 | Open | Red |
The background color of field "Traffic light" should be either Green or Red, depending on the condition:
if Enddate < Today and Status == Done = Green
if Enddate < Today and Status =! Done = Red
Is that possible and are field extensions the right tool?
Thank you very much.
Filipe
Apr 09 2020 10:43 AM
SolutionHi,
You can use column formatting to display the background color in your required field [Conditional formatting based on the other field values] as per your requirement. You would need to construct a JSON object that describes the elements that are displayed when your field is included in a list view and their display style.
Please refer to this sample which will be helpful for your current requirement - https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting#apply-fo...
If you are new to column formatting, please refer to this link which will help you to get started - https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting.
Hope this helps. Thanks.
Apr 13 2020 06:36 AM
Thank you, your answer has pointed me in the right direction.
I was able to combine a calculated column with a column formatting to meet my purpose.
Best regards
Filipe
Apr 24 2020 11:12 AM
There is actually an update rolling out globally that will help do this WITHOUT CODE! It landed in my tenant last week. Good luck - here is a link to the item in the road map. This link shows a lot of updates...but conditional formatting is the one I'm talking about. It's roadmap item
Apr 27 2020 01:42 AM
Apr 09 2020 10:43 AM
SolutionHi,
You can use column formatting to display the background color in your required field [Conditional formatting based on the other field values] as per your requirement. You would need to construct a JSON object that describes the elements that are displayed when your field is included in a list view and their display style.
Please refer to this sample which will be helpful for your current requirement - https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting#apply-fo...
If you are new to column formatting, please refer to this link which will help you to get started - https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting.
Hope this helps. Thanks.