I have a form with a lookup to a document library. When a person selects a document to associate to the list item I want to then have a label populate with a clickable link to that document. I've searched the forum and can't find this solution. TIA!
This is not native functionality for Nintex Forms. The list lookup does associate the item, but populating a clickable link is not something I've ever seen done to date. You may be able to accomplish this with javascript but I'm not entirely sure since the relative and absolute URLs aren't typically surfaced through the list lookup view.
I'm considering writing a simple workflow to populate the link. Once I've got it worked out I can add the functionality to an existing workflow.
it's not possible with a label but it's possible with calculated value control.
once you select a document from lookup dropdown, you basically know it's item ID. you can use the ID for one another lookup made with calculated value control and lookup() function to query for one of library item URL fields (eg. FileRef).
finally you just need to properly wrap lookup() function result up into a html snippet that makes up a valid clickable link. see eg. example - https://community.nintex.com/t5/Nintex-for-SharePoint/Add-variable-to-URL-on-Nintex-Form/m-p/64187/highlight/true#M53056
I will work on this solution today. Thanks!
I've got the calculated value pulling the link, and then trying to append the variable into the URL. I tired appending the relative URL to the domain address but had trouble with that too.
"<a href=" + calcLinkVar + """>Item Link</a>"
I get a page not found error with this code.
you miss there a starting apostrohpee for href attribute.
try
"<a href=""" + calcLinkVar + """>Item Link</a>"
That does try to open, but then I get the option to open or save when I click the link. Then when I select open I get this message.
FYI, the URL that I am using in the calcLinkVar variable looks like what I have pasted below. I suspect that is the problem, but I cannot get it to resolve without the .000
/sites/SiteName/Lists/ListName/3_.000
yes, sharepoint appends some digits to the URL field(s).
I hoped this would be easy to resolve :)
have a look on this example - https://community.nintex.com/t5/Nintex-for-SharePoint/Site-Workflow-Getting-list-Item-URL/m-p/11560/highlight/true#M9676
it's for a workflow, but in forms you can use replace() inline function with the same regular expression to stripp off URL tail.
Should I put the whole lookup function within the replace function, or just the FileRef attribute?
yes, you have to clean URL returned by lookup() function, FileRef is just attribute name
replace(lookup(.....),"_.d+$","")
I wonder if the data type of the calculated value has something to do with it. I've tried generic and string. Doesn't seem to make a difference which one I use. Still get the numeric tail.
We decided to just use the OOTB functionality from view mode. The hot link is already there.
I tried that but still get the tail. This is so frustrating!
ah, sorry - to use regex within calculation formula you need to double backslashes
replace(lookup(.....),"_\.\d+$","")
Reply
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.