My SharePoint Buddy called me today and asked if I could look at something she was trying to do. She had a list form (customized with InfoPath) where she wanted to display a clickable URL that was customized based on a field value in the list. Regardless of how we tried to use calculated values and such, we couldn’t get a clickable URL when she opened the form for display. I did a little research and playing around, and I came up with a nice hack (at least I thought so).
So here’s the basic function we were after (ignore everything but the last two fields… I “repurposed” a test list for this). The URL would be clickable, and was customized with the value in the Search Word field:
The first step was to put a Hyperlink column in the list:
I then went into the form design, right-clicked on the Hyperlink control, and made it “Read-Only” (since we only wanted people to use the link, not to edit it):
Off to SharePoint Designer… I set up a workflow that, when triggered, would built the custom URL in a workflow variable, and then put that variable into the Calculated URL field we added to the list:
In the Set Workflow Variable action, I just took the first part of the URL, added the field that had the custom value, and then added the end of the URL (in this case, we were building a URL for a search result page):
Once the workflow was run, the Calculated URL field was added properly, and the customized form would display it as a clickable link. Exactly what we were after.
She then took it one step further… instead of displaying the URL value like I did on my test page, she just created a link on the page called Description, and set the value of that link to be the contents of the Calculated URL field. So now, the form looks clean, the visible clickable link is the same on all the forms, and the underlying URL in the link is the customized value.
I love when these things work. 🙂
Nice work! I’ll be filing this away to remember how you did this.
I think I tried doing this some time back, and couldn’t figure out how to make it happen. A good example of “ask me again in six months, I’ll know more by then.”
Yeah, that happens a lot around here too… The more you know…
Nice work! I followed your steps but the problem is when am running the form, since I set the Hyperlink to read-only mode I can not see it in the form.