“We would accomplish many more things if we did not think of them as impossible.”
It is possible to create a hyperlink column in SharePoint list but is it possible to create a hyperlink column as a calculated column?
The Answer is "Yesssssssssssssssssss".
Following are the steps to accomplish the same.
1. Create a Calculated Column say URL with the formula to link the list column id to a page.
For example: ="http://sharepoint.com/sites/Test/Page.aspx?ID="&ItemID.
2.Create another calculated column say Info and refer the previously created calculated column here in anchor tag.
For example: =IF(ISBLANK(URL),"No URL",("<a href="&URL&" target='_blank'></a>"))
Now its time to render the Calculated column as a HTML markup in SPO.
1. Ensure that the list is in the modern experience.
2. Click on the URL column-> Column settings->Format this column.
3. A dialog would open. Please click on Advanced and paste the JSON code in the textbox.
Click Save and close the dialog.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "a",
"txtContent": "Info",
"attributes": {
"target": "_blank",
"href": "='@currentWeb' + '/Page.aspx?ID=' + [$ItemID]"
}
}
Now the hyperlink column works like a charm! :)
Happy SharePointing!!!
Comments
Post a Comment