Document Lookup Column Link

Highlighted
Occasional Contributor

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.

8 Replies
Highlighted
Unfortunately there is not a direct way to achieve this...one posible solution could be to customize the project list forms using PowerApps
Highlighted

@Juan Carlos González Martín 

 

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?

Highlighted

@Phil_COB

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.

Highlighted

@Vernon Jones 

 

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.   

Highlighted

@Phil_COB 

 

I'm not sure if I'll go that route, but I'm curious, so yes, please send the details.

Thanks!

Highlighted

@Vernon Jones 

 

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. 

Highlighted

@Phil_COB 

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.

Highlighted

@Vernon Jones 

 

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.