I have a simple JSON formatting code for a column in SharePoint in order to redirect to the appropriate target depending on the content of the record.
Here is the code:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "a",
"txtContent": "@currentField",
"attributes": {
"href": "=IF(LEFT(@currentField,3)=='INC', 'https://domain.service-now.com/nav_to.do?uri=incident.do?sysparm_query=number=' + @currentField, IF(LEFT(@currentField,3)=='PRB', 'https://domain.service-now.com/nav_to.do?uri=problem.do?sysparm_query=number=' + @currentField, 'https://domain.atlassian.net/jira/software/c/projects/CCE/issues/' + @currentField))",
"target": "_blank"
}
}
The format is accepted by SharePoint, but the output is blank. So I'm a bit stunned.
And the simple code is working like a charm:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "a",
"txtContent": "@currentField",
"attributes": {
"target": "_blank",
"href": "='https://domain.service-now.com/nav_to.do?uri=incident.do?sysparm_query=number='+ @currentField"
}
}
Thanks in advance for any help on this.
