PrimaryLink is to display a hyperlink based on the other 2 fields
PrimaryName
PrimaryURL
PrimaryLink
JSON for Column Formatting
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "a",
"txtContent": "[$PrimaryName]",
"attributes": {
"target": "_blank",
"href": "[$PrimaryURL]"
}
}
So if I enter a PrimaryName and a PrimaryURL, it would display the PrimaryName as a hyperlink in PrimaryLink to what was set in PrimaryURL. If I only put a PrimaryName in, it still displays a hyperlink that goes to the /list/AllItems.aspx
Is there a way where if I don't populate PrimaryURL, that it can only display PrimaryName text and no hyperlink?
Tried this from a post recommended in comments, but it leaves the whole column empty.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "a",
"txtContent": "[$PrimaryName]",
"attributes": {
"target": "_blank",
"href": "[$PrimaryURL]"
}
"style":{
"display": "=if([$PrimaryURL]!='', 'block', 'none !important')"
}
}
"style": { "display": "=if([$PrimaryURL]!='', 'block','none !important')", }