Remove the link from a lookup field

Learn how to remove the link from a lookup field


If you are using a lookup field in SharePoint, the selected value will be a link to that value.
This is not always a good experience for the end-user 😣
An example could be that you are using a lookup field for the user to select a country.
Your column would then look like this with a blue clickable link 👇

If the user clicks the link - in my example here - the user will be directed to the item, that could look like this 👇

Not a very pretty experience for the user, since my country list is only used as “back-end” data.

In most of my views I always end up “disabling” the lookup field as a link.

How to

To remove the link, we can apply JSON formatting to the column.
Select the column, choose Column settings -> Format this column
In the panel that appears on the right, select Advanced mode

Here you can insert the following code

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
  "elmType": "span",
  "txtContent": "@currentField.lookupValue"
}

Short explanation of the code

txtContent will show the selected value, when we use @currentField

We could add a link in the JSON code, change the color, add or button or almost anything we desire, but in this case we use the JSON to remove everything, and just show the value.

When you are using @currentField on a lookup field it is important that you add the .lookupValue, otherwise you will see the value as [object Object]

In most other cases you should only use @currentField

Now our lookup field will look like this, and is unclickable 👇👌

Additional reading - what is a lookup field?

A lookup field is a column that allows you to connect a list to another list on your site, and display information from the source list on the target list.

A lookup field can also show additional data from the specific list (ex. the country code)

When you are working with Power Apps a lookup field can also be very powerful when collection data.

Unfortunately a lookup field can not be linked between different sites, which would have been a huge benefit 🙆‍♂️

Article about lookup fields from Microsoft
Article about lookup fields from SharePoint Maven


See also