@cjones, unfortunately, this is not something that is done out of the box with Nintex or SharePoint.
I would have to ask why are you wanting to put the link on task form? I think querying the attachments, put them in a document library with a tag and then grabbing those links is the best way to tackle this.
The reason I would like to link them from their original location on the task form is because I find it redundant to copy the attachments to a document library to then just link to them there, when linking to them in their original location would suffice.
Try doing below steps to your workflow.
- Create a Text Variable AttachmentsHTML (we build the html for existing attachments into this variable)
- In the loop action, after u get Name and url, use build string to build the html and append it to above variable. Some thing like: {Variable: AttachmentsHTML}<br/><a href="{Variable: Link}">{Variable: Name}</a>.
- Out put of above action is set to same variable.
- Now you will have all the attachments links in html structured format
- In the Assign task / task proces, edit the form and use a "Caclualted Value" control, in the formula section, add the AttachmentsHTML variable..
@cjones I understand it seems redundant, but attachments on list items do not operate in the same manner as documents in a document library. You have more control, access and features setup for the documents in a document library; whereas attachments are just files you can access via a REST call that gets complicated somewhat fast.
I wasn't suggesting your reason was not good, just stating that if you push those items to the document library, it actually makes your life easier getting the links to the documents and showing them on the form.
This is the same approach I've taken as well in order to provide direct links to attachments within task forms and email notifications.
I'd love for Nintex to build this into the product, but in the meantime you can workaround it by parsing XML, iterating your attachments (URLs and Names), and generating an HTML table which can be included in either.
Just remember that you'll have to re-generate these attachments between workflow approvals/stages or put yourself at risk for the attachments getting out of sync.
This worked perfectly for what I need! The only thing I had to change was to put both the variable and link in seperate paragraph tags so they displayed a little nicer. For some reason the responsive form didn't like the line break. Anyways, thanks for your help! It was greatly appreciated. Below is what I ended up with in my "Build String" action.
<p>{Variable: AttachmentsHTML}</p><p><a href="{Variable: Link}">{Variable: Name}</a></p>
Oh I completely understand. In this situation though it just didn't make sense to go through all of that. The attachments are not edited through the process. If they need edited, the request is denied and they must submit a new item with the edited version. So sense the attachments are only viewed, just linking to them on the original list item would suffice. Thanks for your help though!