Hi,
I want to add a conditional formatting code to column Kickoff Complete Date. If the column is blank and today's date is greater than [Kickoff Deadline], I would like the Kickoff Complete Date to be highlighted. I understand this need to be done by inserting a Json code in column setting. But I have no clue about Json. Can someone help please?
Solved! Go to Solution.
Hey @jeanwang
Hey @jeanwang
Yes. You can do that with the column formatting in JSON on the SP List. Try using the below schema:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "attributes": { "class": "=if([$KickoffDeadline]<=@now,'sp-field-severity--warning', '')" }, "children": [ { "elmType": "span", "style": { "display": "inline-block", "padding": "0 4px" }, "attributes": { "iconName": "" } }, { "elmType": "span", "txtContent": "@currentField" } ] }
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
@yashag2255 wrote:Hey @jeanwang
Yes. You can do that with the column formatting in JSON on the SP List. Try using the below schema:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "attributes": { "class": "=if([$KickoffDeadline]<=@now,'sp-field-severity--warning', '')" }, "children": [ { "elmType": "span", "style": { "display": "inline-block", "padding": "0 4px" }, "attributes": { "iconName": "" } }, { "elmType": "span", "txtContent": "@currentField" } ] }Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Thank you very much for the scheme. It looks like you code didn't mention the first condition that the current column, i.e., [Kickoff Complete Date] should be blank.
Probably it will help if I explain my need in more detail. I aim to create a project plan based on SharePoint list. Each time an activity is completed, the owner needs to fill the [complete date], if the [complete date] column is blank and the deadline data is past, I would like the blank column [complete date] to be highlighted. In this way, we know at which step the project is delayed. So in my case , the condition will be:
if current column [Kickoff Complete Date] is blank,
&
column [Kickoff Deadline] <now
highlight current column [Kickoff Complete Date]
end if
Can you please help with the schema?
Thank you!
Hey @jeanwang
Thank you so much! It works perfectly this time. This give me a start on Json as well, I will try to learn a bit about Json myself so that I can configure the objects and operators myself in future.
Hi Jashag,
You shared with me a Json script for column formatting which worked perfectly last time. However, when I tried to update the script and paste it to another column. It doesn't seem to work.
Below is my Sharepoint list and the script I pasted to column Draft Deadline.
Actually the Json code seem to do something strange with my sharepoint list. Instead of highlight the column in yellow as it should be, it seem to highlight the column into white or hide values being put into the column. I had input a date into the Draft Date column, but the date was invisible if the Json code was there. Date re-appeared after I removed the Json code. Do you know the reason?
Thanks!
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"attributes": {
"class": "=if([$DraftDeadline]<=@now,if(toString(@currentField) == '','sp-field-severity--warning', ''),'')"
},
"children": [
{
"elmType": "span",
"style": {
"display": "inline-block",
"padding": "0 4px"
},
"attributes": {
"iconName": ""
}
},
{
"elmType": "span",
"txtContent": "@currentField"
}
]
}
Hey @jeanwang
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!
User | Count |
---|---|
40 | |
36 | |
35 | |
32 | |
27 |
User | Count |
---|---|
38 | |
37 | |
33 | |
26 | |
22 |