When we create an item with attachments  in the Parent List, it should copy the attachments from the parent item and paste the same into Child List. After pasting the attachments in the child list, we have to delete the attachments from the parent list item.

Approach tried and failed:

To copy List Attachments from one list to other List, we tried to use Add Attachment method using lists.asmx web service. But we got the following error:

“Failed to invoke Web Service. Object reference not set to an instance of an object”

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

  • Create a hidden Document Library that will be a temp storage of files.
  • 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).
  • 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.
  • 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.

Thank you Nintex Team, Saravana and Anil who helped me to implement this :)