Forum Discussion
Phil_COB
Aug 09, 2019Copper Contributor
Document Lookup Column Link
Hi, all, In SharePoint Online I have a doc library (Reference Docs) and a list (Projects). The goal is for users to choose a doc from a lookup drop-down in Projects, which, when clicked, will...
Phil_COB
Sep 10, 2019Copper Contributor
Hi,
A workflow copies the link from the Name column to a "linked" column in the doc library. To stop it from opening the doc's properties, it needs to be formatted using the following JSON:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "a",
"txtContent": "@currentField",
"attributes": {
"target": "_blank",
"href": "=@currentField"
}
}
I then used a look-up column to pull this link to a data list, and formatted it with the same code.
Let me know if you need anything else.
rjuun
Feb 26, 2021Copper Contributor
Dear Phil,
I am in a very much similar situation as you were.
I have a "Topics by Meetings" list in which Topics (from topics library) are associated with each Meeting (from Meetings List).
This was structure as such, because each Topic can be discussed in a series of meetings before it is actually "approved", while:
- the "evolving" documentation remains one single Topic folder
- the "Topics by Meetings" registers all the comments discussed about the Topic in each Meeting
In this image, you will see the "Number" column which is a "lookup" from Topics as a hyperlink.
As you mentioned, the hyperlink points to the Document Properties rather than the actual Folder.
I tried to apply you json formatting....
------------------------------------------
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "a",
"txtContent": "@currentField",
"attributes": {
"target": "_blank",
"href": "=@currentField"
}
}
------------------------------------------
and it resulted as follows:
Would you know what am I missing to get the hyperlink properly pointing to the original lookup folder ?
Appreciate any inputs...
Cheers
- LiamCromarMay 19, 2021Copper Contributor
On a lookup field, you need to reference @currentField.lookupId and/or @currentField.lookupValue to access its properties.