cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Is it possible to use a Nintex workflow in SharePoint to copy/move an attachment from an item in list A to an item in list B?

Jump to solution

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!

Labels: (1)
0 Kudos
Reply
15 Replies
Workflow Hero

Re: Is it possible to use a Nintex workflow in SharePoint to copy/move an attachment from an item in list A to an item in list B?

Jump 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.

0 Kudos
Reply
Workflow Hero

Re: Is it possible to use a Nintex workflow in SharePoint to copy/move an attachment from an item in list A to an item in list B?

Jump to solution

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.

0 Kudos
Reply
Workflow Hero

Re: Is it possible to use a Nintex workflow in SharePoint to copy/move an attachment from an item in list A to an item in list B?

Jump to solution

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. 

0 Kudos
Reply
Not applicable

Re: Is it possible to use a Nintex workflow in SharePoint to copy/move an attachment from an item in list A to an item in list B?

Jump to solution

Use _vti_bin/Lists.asmx webservice to copy items in list.

0 Kudos
Reply
Not applicable

Re: Is it possible to use a Nintex workflow in SharePoint to copy/move an attachment from an item in list A to an item in list B?

Jump to solution

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).

  1. Create a hidden Document Library that will be a temp storage of files.
  2. In your workflow on List1, add a Copy to SharePoint which for a List Item, it will copy the attachment to the configured destination Document Library (your hidden library).
  3. In your document library, create a workflow that starts on item creation.  Configure it with a Call Web Service action, and to call the AddAttachment web method.  This will now work, because this workflow is running on a file.
  4. Then you can configure the workflow to delete the current item to do a clean-up.

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.

http://<siteurl>/_vti_bin/NintexWorkflow/Workflow.asmx

That has a StartWorkflow web method you could use.

0 Kudos
Reply
Workflow Hero

Re: Is it possible to use a Nintex workflow in SharePoint to copy/move an attachment from an item in list A to an item in list B?

Jump to solution

Hi Rebekah,

 

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.

 

cheers,

Vadim

Reply
Not applicable

Re: Is it possible to use a Nintex workflow in SharePoint to copy/move an attachment from an item in list A to an item in list B?

Jump to solution

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!

Reply
Not applicable

Re: Is it possible to use a Nintex workflow in SharePoint to copy/move an attachment from an item in list A to an item in list B?

Jump to solution

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"?>

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m="http://schemas.microsoft.com/sharepoint/soap/">

  <soap:Header>

  </soap:Header>

  <soap:Body>

    <m:AddAttachment>

      <m:listName>Abnormal Operating Conditions</m:listName>

      <m:listItemID>{ItemProperty:AOCItemID}</m:listItemID>

      <m:fileName>{ItemProperty:FileLeafRef}</m:fileName>

      <m:attachment>base64Binary</m:attachment>

    </m:AddAttachment>

  </soap:Body>

</soap:Envelope>

0 Kudos
Reply
Not applicable

Re: Is it possible to use a Nintex workflow in SharePoint to copy/move an attachment from an item in list A to an item in list B?

Jump to solution

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.

Reply