I have a flow that populates a multi line text column in SharePoint. I want the fields to be clickable as they are links. I didn't format the column to be a hyperlink b/c some links are over the 255 character limit. Is there a way to change the format of multi line text column so that it is clickable through JSON?
-
Is this plain multi line of text column? Try creating rich or enhanced rich multi line of text column.Ganesh Sanap - MVP– Ganesh Sanap - MVP2020-07-21 15:49:12 +00:00Commented Jul 21, 2020 at 15:49
-
It is a rich column.PowerBI87– PowerBI872020-07-21 18:03:34 +00:00Commented Jul 21, 2020 at 18:03
-
Good point @Vann Just a plain text, many guidelines say rich text but if you use rich text, the hyperlink will break because of adding <div class=.. in the link. Thanksya MBODJI– ya MBODJI2023-12-20 08:59:39 +00:00Commented Dec 20, 2023 at 8:59
2 Answers
Here is a sample script for JSON formatting:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "a",
"txtContent": "=if(@currentField=='','','Click Here')",
"attributes": {
"target": "_blank",
"href": "='https://tenant.sharepoint.com/' + @currentField"
}
}
The multiple line text column needs to be set to allow only Plain text since (Enhanced) Rich text will add additional elements to the column values so that it breaks the formatted hyperlinks.
Reference: Create clickable actions - Turn field values into hyperlinks.
Another sample: SharePoint Column Formatting - Display A Single line Of Text As Hyperlink.
For rich text column, you can try using HTML tags inside the text to create the the hyperlink:
<a href="https://www.google.com/">Access Google</a>
Result would be like this: Access Google