Forum Discussion
CarolinaMiC
Aug 03, 2021Copper Contributor
Possible Bug with SharePoint Hyperlink Column and Format This Column
How to reproduce: Environment: SharePoint Online - Modern Communication Site Registered as a Hub (Targeted Release) 1. Create a new Hyperlink column in a modern SPO list. 2. Add an item and ...
Sourceress
Aug 23, 2023Iron Contributor
Yeah - two years later and its still not working.
ganeshsanap
Aug 23, 2023MVP
Yes, this bug is still there in the SharePoint. Instead of using default styling and color options, use JSON like below in "Advanced mode" of the column formatting option for hyperlink column:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "a",
"style": {
"box-sizing": "border-box",
"padding": "0 2px",
"overflow": "hidden",
"text-overflow": "ellipsis",
"text-decoration": "none",
"color": "#555555"
},
"attributes": {
"class": "sp-field-fontSizeSmall sp-field-bold",
"href": "[$HyperlinkCol]"
},
"txtContent": "[$HyperlinkCol.desc]"
}
Where HyperlinkCol is the internal name of hyperlink column. You can get the internal name of your column by following this article: How to find the Internal name of columns in SharePoint Online?
OR use @currentField for href and @currentField.desc for txtContent.
Output:
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.