question

VictorS-7838 avatar image
0 Votes"
VictorS-7838 asked YiLu-MSFT commented

Adding SLA values to a SharePoint list column Priority (Critical, High, Normal, Low) via JSON?

Looking for a JSON formatting that will add Priority SLA to the Priority column: Critical 12 hours, High 24 hours, Normal 48, Low 72 hours

Default JSON code that is included with the issues list appears as a "pill" with an icon and text status text inside the pill. Need to add additional text:

Critical - 12 hours
High - 24 hours
Normal - 48 hours
Low - 72 hours

199033-screen-shot-2022-05-05-at-120740-am.png

Default JSON code for reference:

{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"style": {
"flex-wrap": "wrap",
"display": "flex"
},
"children": [
{
"elmType": "div",
"style": {
"box-sizing": "border-box",
"padding": "4px 8px 5px 8px",
"display": "flex",
"border-radius": "16px",
"height": "24px",
"align-items": "center",
"white-space": "nowrap",
"overflow": "hidden",
"margin": "4px 4px 4px 4px"
},
"attributes": {
"class": {
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$Priority]",
"Critical"
]
},
"sp-field-borderAllRegular sp-field-borderAllSolid sp-css-borderColor-neutralPrimary",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$Priority]",
"High"
]
},
"sp-field-borderAllRegular sp-field-borderAllSolid sp-css-borderColor-neutralPrimary",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$Priority]",
"Normal"
]
},
"sp-field-borderAllRegular sp-field-borderAllSolid sp-css-borderColor-neutralPrimary",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$Priority]",
"Low"
]
},
"sp-field-borderAllRegular sp-field-borderAllSolid sp-css-borderColor-neutralPrimary",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$Priority]",
""
]
},
"",
"sp-field-borderAllRegular sp-field-borderAllSolid sp-css-borderColor-neutralPrimary"
]
}
]
}
]
}
]
}
]
}
},
"children": [
{
"elmType": "span",
"style": {
"line-height": "16px",
"height": "14px"
},
"attributes": {
"iconName": {
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$Priority]",
"Critical"
]
},
"ErrorBadge",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$Priority]",
"High"
]
},
"SortUp",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$Priority]",
"Normal"
]
},
"",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$Priority]",
"Low"
]
},
"SortDown",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$Priority]",
""
]
},
"",
""
]
}
]
}
]
}
]
}
]
}
}
},
{
"elmType": "span",
"style": {
"overflow": "hidden",
"text-overflow": "ellipsis",
"padding": "0 3px"
},
"txtContent": "[$Priority]",
"attributes": {
"class": {
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$Priority]",
"Critical"
]
},
"",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$Priority]",
"High"
]
},
"",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$Priority]",
"Normal"
]
},
"",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$Priority]",
"Low"
]
},
"",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$Priority]",
""
]
},
"",
""
]
}
]
}
]
}
]
}
]
}
}
}
]
}
]
}


office-sharepoint-online
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @VictorS-7838
Has this issue been resolved, if yes, you could posted your answer so that it would hepl others who meet the similar issue. If you still need further help, please feel free to reply.

1 Vote 1 ·

@YiLu-MSFT Thank you. Answer had been posted - code, explanation, and screenshot of the result.

0 Votes 0 ·

Answered my own question.

0 Votes 0 ·

1 Answer

VictorS-7838 avatar image
0 Votes"
VictorS-7838 answered YiLu-MSFT commented

I added SLA hours text AND added colors via Style Sheets.
Screenshot and JSON code file attached.

This is for SharePoint Online Issues List, Priority column.
You will also need to augment the column values to match the JSON code:
Critical - 12 Hours
High - 24 hours
Normal - 48 hours
Low - 72 Hours


199238-sharepoint-online-issues-list-priority-column-with.txt
199178-screen-shot-2022-05-05-at-110810-am.png




· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @VictorS-7838
Thanks for your sharing. Have a nice day :-)

0 Votes 0 ·