I've also noticed that when asking certain URL's, nintex returns me the relative rather than the absolute URL. And sometimes it requests a relative URL, where an absolute one won't work.
It's a bit trial and error (tho I'm sure there is some kind of logic involved.)
What I do when I build a report-mail with links in it, I pick up the URL, print it to the log and check what format it is.
If it's a relative one, depending on what needs to be done, I may break it down with a regular expression split on '/' (http: will always be on location 0 in the collection and 'sharepoint.weburl.com' will be on location 2 (because of the double slash behind http: and so forth.
It takes some struggling in the beginning, but after a while you'll get the hang of it. I always use a string to build up the link piece by piece, and gradually I use that same string to build line by line of my mail.
Hope this helps.
Thank you Thorsten for your response.
I am also looking into same direction to write some short of regular expression to update all hyperlinks in specified value, but my challenge is that I have other contents into announcement “Body” column, so I think it is very hard to write regular expression to take value from all hyperlinks from “Body” column and add http://sharepoint.weburl.com/ to starting of the hyperlink value.
If I have only URL value into “Body” column then I can go with your approach to split URL on “/” and add 'sharepoint.weburl.com' to collection variable but I have other contents into “Body” column with URL as well.
Please let me know if you know any regular expression which will go into specified Input text and extract href value from all links inside text and update it with actual SharePoint site URL.
Example:
Input text :
This is test announcement
<a href="/sites/subsitename/listname/documentname"> click here</a>
Output
This is test announcement
<a href="http://sharepoint.weburl.com/sites/subsitename/listname/documentname"> click here </a>
Again, thanks much for looking into my question.
Perhaps the in-line function 'Replace' can help in this case. But you'll have to get a little creative getting it to work (to use the " in a string)
Basicly you could replace href="sites/subsitesname with href="http://sharepoint.weburl.com/sites/subsitename in a build string block
by using fn-Replace.
one way would be to create a few standard strings:
- strAnnouncement (this is what you'll use to 'build' your end-result, and you start by filling it with your basic announcement)
- strRelative= href="/sites/
- strAbsolute= href="http://sharepoint.weburl.com/sites/
the function would become something like fn-replace({WorkflowVariable:strAnnouncement},{WorkflowVariable:strRelative},{WorkflowVariable:strAbsolute})
But as I said, you might need to get creative since you are using a load of special characters.
Thanks again Thorsten for your valuable feedback.
I tried with inline replace function but it didn’t work and it displayed fn-replace as a static text in email, instead of actually replacing old string with new string (Before also, I had similar issue with inline replace function).
So after inline replace function, I tried with regular expression action and it short of working fine with your provided logic as replace function. I’ve created 3 different parameters to store actual Announcement value, relative URL path and absolute URL.
Below is screenshot for Regular expression activity:
Thank you for giving direction on solution.
I told you to get creative. You got creative.
It's your solution, not mine. But I'm glad I helped you get there.
Yep, Frank I've marked correct answer in this thread. thank you.
Hi Sanket,
I had the same issue and tried your solution which works great. Thanks.
However now if someone pastes the link straight into the body instead of inserting the link, the link shows up like https://sharepoint.comhttps://sharepoint.com/sites/list etc and no longer works. Is there a way to stop this?
Thanks,
Jesse
Hello Sanket ,
I have a column which has sharepoint URL : Lets Say : https://abc.com/SiteName/subsite.aspx
I need to split this URL till Site name and save it in a new variable and use it. Can you please help me