08-09-2019 12:47 PM
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 directly open the chosen document stored in Reference Docs.
So, in Reference Docs I created a workflow that sets the value of the Title field with the Name field.
In Projects I created a lookup column referencing the Title field in Reference Docs
All works fine, except the link opens the document properties, not the document itself.
This should be simple, but I just can figure out what is incorrect.
Any help will be appreciated.
08-09-2019 01:40 PM
08-09-2019 02:10 PM
Thanks for the reply. Maybe I wasn't clear in my question.
The list (Projects) is like a spreadsheet, not a form. In Quick Edit, I wanted users to choose a document from a look-up column connected to a library (Reference Docs).
Since you can't base a look-up on the Name column, I assumed you could achieve this by setting the Name field to the Title field and basing the look-up on the Title field.
Everything works, except when Quick Edit is closed the look-up column shows the document name as a link, but clicking it opens the document's properties page, not the document itself as you would get by clicking the Name column.
Does that make more sense?
09-09-2019 09:00 AM
I found the same issue. In the Classic UI, lookup documents opened directly from the list, but in Modern, clicking the document takes you to the document properties, which is not very useful.
Also, if you open the list item and click the lookup document, it opens a property window, but clicking the link to the document name doesn't do anything. The only way to open the document is to right-click and open in a new tab.
It appears that the functionality for opening lookup documents didn't come over from Classic. Not opening from a property window may be a bug.
09-09-2019 10:31 AM
Thanks for the reply. I figured this was the case.
I did get it to work, but it took a workflow and JSON coding to extract the link elements then combine them to recreate the link.
What was once simple is now way too complicated...
If you want details, please let me know.
09-10-2019 06:32 AM
I'm not sure if I'll go that route, but I'm curious, so yes, please send the details.
Thanks!
09-10-2019 10:29 AM
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.
09-11-2019 04:34 AM
Thanks! Great workaround. I have the link working, but are you able to display the name of the file instead of the url? If so, I need a pointer in how to fill in that missing piece.
09-11-2019 11:14 AM
It wasn't part of the scope of the project, so no. I'll experiment and if I find anything I'll let you know.
11-13-2020 01:49 AM - edited 11-13-2020 01:51 AM
I had a second lookup column that was coded with JSON to show a button as the link:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "button",
"txtContent": "Open",
"customRowAction": {
"action": "defaultClick"
}
}
Unfortunately, my internal customer has discovered that they no longer get links :(
I am assuming that there has been an Evergreen update that has broken the functionality?
I found this thread in my research to find a new solution.