We recommend that you create a Single line of text column and then convert this column into hyperlink formatting.
Please the following steps:
1.Create a Single line of text column in the list
2.Format this column
3.On the Formati column panel, click on Advanced mode
4.Use the below JSON:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "a",
"txtContent": "@currentField",
"attributes": {
"target": "_blank",
"href": "='https://****.sharepoint.com/sites/sitename/Lists/listname/AllItems.aspx?FilterField1=MasterID&FilterValue1='+[$ID]"
}
}
Here is a similar case for your reference:
========================== Updated Answer ======================
If you want to display the Hyperlink's URL and Alternative text in the Display Form.
Please following steps:
1.Create the following columns in the list
- TestID: Single line of text (TestID must be equal to ID)
- MasterID: Single line of text
- PrimaryName: Single line of text
- PrimaryURL: Calculated (calculation based on other columns)
Formula:
=CONCATENATE("https://***.sharepoint.com/sites/sitename/Lists/listname/AllItems.aspx?FilterField1=MasterID&FilterValue1=",[TestID])
- TestLink: Single line of text
2.Column Formatting
3.Paste the following code:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "a",
"txtContent": "[$PrimaryName]",
"attributes": {
"target": "_blank",
"href": "=[$PrimaryURL]"
}
}
4.Hide Column