Forum Discussion
Eliot_Cole
Jun 23, 2025Iron Contributor
List Column Formatting - Set WHOLE Attributes Object If Column Has Content
Hi, I would essentially like to know how to achieve one of two outcomes in my view formatting dependent on the column in question having a value. The following are the two eventualities I would like...
Rob_Elliott
Jun 24, 2025Silver Contributor
Eliot_Cole you can do this with the following JSON:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "a",
"txtContent": "=if(@currentField!='', @currentField, 'No URL')",
"attributes": {
"target": "=if(@currentField!='','_blank', '_self')",
"href": "=if(@currentField!='', @currentField, '')"
}
}
..which gives the following result:
Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, SharePoint and Power Platform WSP Global (and classic 1967 Morris Traveller driver)