Solved

Nintex Site Workflow - URL Issue

  • 3 April 2016
  • 8 replies
  • 107 views

Badge +3

I’ve created site workflow which is running on top level site and going through all Announcements list on sub-sites level to retrieve value/content from Body column (which is Multiple lines of column type with Enhanced rich text option) and sending Body column value in send email workflow action.

 

Issue: Somehow Site workflow send email activity is changing absolute URL to a relative URL for Announcements body text, so when I received email with hyperlink it has relative URL which is broken URL without SharePoint site name.

e.g. Email has /sites/subsitename/listname/documentname URL instead of http://webappURL/sites/subsitename/listname/documentname.

 

Interesting thing is, if I create and run workflow on list level and use send email activity to retrieve value/content from Announcements Body column – everything works fine, I’m getting absolute URL from list workflow but site workflow is not appending web application URL to all the links inside value.

 

I saw someone also has similar issue like me: https://community.nintex.com/thread/5819. As suggested in post - I really don’t want to mess up with any global/default settings provided by Nintex workflow.

 

As a one alternative option, I’m thinking if I can write magical Regular expression which will find all anchor tags(A href) and retrieve its respective value (ie. /sites/subsitename/listname/documentname) from any given variable and append webappURL in front of its value then I can manually add missing webapplication URL to all hyperlinks from body value – again this is my thought, I don’t know whether it’s possible or not.

 

Any help/assistance is much appreciated.

 

Thanks in advance!

 

~Sanket Shah

icon

Best answer by sanketshah_18 4 April 2016, 19:16

View original

8 replies

Badge +4

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.

Badge +3

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.

Badge +4

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:

  1. strAnnouncement (this is what you'll use to 'build' your end-result, and you start by filling it with your basic announcement)
  2. strRelative= href="/sites/
  3. 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.

Badge +3

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.

Badge +4

I told you to get creative. You got creative. 


It's your solution, not mine. But I'm glad I helped you get there.

Badge +3

Yep, Frank I've marked correct answer in this thread. thank you.

Badge +3

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

Reply