Is it possible to use a Nintex workflow to copy/move an attachment from an item in list A to an item in list B? I am creating a workflow that uses the assign to-do task action to collect information from various individuals. Part of what is collected in this task is a Word/Excel document which gets stored in the Workflow Tasks list. I am needing to copy/move the attachment back to the original item in my custom list. Does anyone have a solution for this? I'm fairly new to SharePoint and Nintex and, due to company restrictions, I do not have the ability to write code for this. Thanks!
Solved! Go to Solution.
This same question was recently discussed on the old site. Nintex Connect - Extract Workflow Task attachment and add to List item attachments. You'll need to use the Copy to SharePoint action to copy the items from the task list to a library, and then run another workflow using the AddAttachment web service to take them from the library and attach them to the item.
I have a similar requirement as Rebekahs. Unfortunately my work location has disabled the "Call web service" workflow action so I am unable to call the AddAttachment service. The "Copy to SharePoint" action works fine for copying attachments to a holding library but then I need the ability to attach the documents to another list item. A workflow action that allowed for attaching a document would be helpful.
Well, not sure what to say to that. If you don't have the "Call web service" action, you're really limited in what you can do. Web Services give you a lot of options that you don't have in all the other actions.
To implement this in Nintex, we don’t have any way to directly copy attachments from a List Item to another List Item.
The reason is, the AddAttachment method is either looking for Base64 encoded binary data, or the [FileData] command. The [FileData] command tells SharePoint to get the current files data. But given that this is running a list item, there is no current file.
So the only workflow around I can think of, is this (you may hate this).
There may be some other things you will need to do like after the Copy to SharePoint, you may need to update something on that document which tells the workflow on that library which item you want to copy to.
So you might consider that doclib workflow not run automatically, and instead in your first workflow, Copy to SharePoint, Update an Item and then have a Call Web Service action to call the Nintex Workflow web servce to start a workflow on that document.
That has a StartWorkflow web method you could use.
I ended up using a Call Web Service action, a Web Request action and also a custom action that I built to get the Base64 data - Nintex Workflow - Get List Item Attachment in Base64 Custom Action (Happy Thanksgiving) - Vadim Taba...
Some of the suggestions above will also work, but would require the Call Web Service action.
Maybe you could talk to your IT team and instead of them exposing that the Call Web Service action, get them to build you a UDA (user defined action) that wraps the Call Web Service action. That way, you can use the UDA, but not see that it's actually making a web service call.
Thank you! I was able to follow your guidance and develop the appropriate workflows. This works great if there is only one attachment being pulled; however, when I tested it with two attachments that are on the same item in list A, they are moved to the hidden library as two separate documents and the first document is attached to the item in list B but the second document gives me an error that it is unable to invoke web service.
Does anyone have thoughts on how to correct this? Thanks!
I have everything working according to the steps you listed and the only part that is not is the actual web service call to AddAttachment. My workflow is running on my "hidden" document library, but I'm not 100% sure what to put for the parameters. Below is what I am putting. Does anything look wrong? The workflow is attaching a file to my list without error, but when I click on the attachment that was just added by the workflow, I get an error saying the contents are corrupt (have tried both pdf and docx)
<?xml version="1.0" encoding="utf-8"?>
<m:listName>Abnormal Operating Conditions</m:listName>
I found my problem. I overlooked a key part of Sivakumar's response: I needed to use the [FileData] command in the <m:attachment> tag, replacing the default "base64Binary". This command will base64-encode the contents of the file that the workflow is being run on in my document library. I also found a brief reference to [FileData] this at http://nintexdownload.com/helpfiles/nw2010/NintexWorkflow2010UserManual.html by searching on base64.