HTML Links to Attachments Not Working

Jump to solution


I am using a Build String action to create links to attachments to be used in a task form. I am basically following the steps I asked in this post way back when. However, when I follow the same steps in Nintex 2016, the workflow throws in a jumble of junk to the end of the hyperlink and it doesn't work. I am using the Rich Text action in the flexi task form instead of the multi-line text field (although that doesn't work, either). The process in order:

  1. User fills out form, attaches at least one attachment.
  2. Workflow gets the attachments from the form.
  3. Workflow loops through collection and creates URL to attachments.
  4. Workflow adds URL as a field in workflow task form so approver can view the attachments from the task form and not from the email notification.

My workflow:

The rich text field in my flexi task form:

I thought perhaps trying to create multiple links was the problem, but it still doesn't work with just one attachment. The hyperlinks I generated from the form attachments work. When I send myself an email, this is what I get:

This URL format doesn't work in the rich text field, either. When I use the links I create (red framed box in workflow screenshot), the workflow throws in a bunch of garbage at the end of the URL and it doesn't work:

This %3C and %3E are the brackets surrounding the HTML and the word "Attachments":


I played around with a few things.

1) using a regular expression to remove the characters (red box, previous screenshot)

2) connecting a field in the task form to the variable that holds the links

3) connecting a field on the task form to the field on the list after I had updated the item with the attachments variable

This works when there is just one attachment or on the very last attachment in the collection.

This is how I want it to look, but Attachment 1 and Attachment 2 still have the garbage at the end of the URL. Attachment 3 works just fine (and so does a single attachment).

The garbage gets thrown in at the end after the last build string action:

I'm not sure why this doesn't work. I've tried replacing the characters as "</attachment><attachment> and as "%3C/Attachment%3E%3CAttachment%3E" and no luck. Replacing the text only works on the last value in the variable. I tried it with a collection also.

a) Why is the workflow throwing in this garbage when I create my itemAttachments_multi variable to hold them all?

b) Why doesn't replacing the text with a regular expression work on all the data in the variable?

0 Kudos
3 Replies

Re: HTML Links to Attachments Not Working

Jump to solution

are you really sure it's caused by a build string action. I'd rather suspect some inproper handling of a XML returned from webservice.

make sure that regex actions after the web service call doesn't (accidentally) add an additional element(s) with that 'attachment' strings.

further, I somehow miss the reason for two web service calls. first one should already return you all the attachemnts' URLs. or what does it exactly do?


Re: HTML Links to Attachments Not Working

Jump to solution

There is 1 web service call that gets the attachments and 1 query XML that pulls each URL out of the collection. You suspect that it could be getting messed up in the Query XML action?

I have a normal looking attachment URL after my Query XML, I get this:

I get the same result when I click "Run Now" inside the action and when I send myself the results in an email.

Then I remove spaces because the site and list were created with spaces. I replace the space " " with "%20". But when I add the HTML to make it a hyperlink:

<a href="{WorkflowVariable:attachmentsURL_text}">Attachment {WorkflowVariable:index_num}</a>

and save it in a multi-line text variable called hyperlink_multi, I get this each time:

If the data wasn't queried right in the Query XML action, wouldn't I see it?

0 Kudos

Re: HTML Links to Attachments Not Working

Jump to solution

Figured it out. There was a subtle difference in the garbage that it threw in. In my tests of 3 attachments, it added:


to the first two and:


to the second two. I added a second Reg Ex to remove those characters and it works beautifully, just the way it should.

However, the original issue still remains:

Why did it add this junk in the first place?

I ran many tests and pinpointed it to this action:

I had a beautiful hyperlink before I added the href tag to make it a URL. When the hyperlink goes in as "attachmentsURL_text", it's normal. When it comes out as "hyperlink_text", it's got the junk at the end.

I have a fix and it works and I'm happy, but I'd sure like to know why this happened in the first place.