So the scenario is that I have a document library A that contains folders and files. When a status is updated to "sold" a nintex workflow will run and if this condition is met, create a new folder with the same name and metadata in document library B, copy all the contents of the source folder from doc library A into the newly created folder in doc library B, then delete the original folder and files from doc library A.
Both doc libraries exist within the same site collection and site for that matter. There are several variations of this type of workflow already working within my environment.
However, I've had to recreate one today and each time I run it the workflow errors at the Copy to SharePoint action with the following:
Failed to copy item. Object reference not set to an instance of an object.
To explain my workflow some more, I have a conditional action to begin that checks if the folder's status is "sold", from this I set a "FolderName" variable to the name field of the folder. After some logging and checks I then create an item in doc library B (essentially the folder, which works fine), then I use the Copy to SharePoint action to copy the folder contents into the new folder in doc library B. I build the URL as a string, using the URL of the destination library, plus the FolderName variable I captured earlier.
What's weird is I can see that the variable is capturing the folder name and the folder is being created. But I cant understand why the copy action action falls down each time.I've atttached the config behind my copy action for info.
Any advice greatly appeciated!
This is an odd thing for sure. I would suggest looking at this post here and see if some of the steps in this or comments apply to your situation.
Thanks for the suggestion, I turned on error handling and now its completing all the actions in my workflow. Curiously, its not actually copying any files across though. the workflow completes and all actions are green but theres nothing in the newly provisioned folder in the destination doc library.
Just a quick update on this one, I have realised I was running the workflow at the incorrect level!
When I run the workflow at the file level the file copies across as expected. I think to be able to run this workflow at the folder level to copy all its child items I would need to do something similar to this post:
Definately one note to take home was enabling error handling allowed my workflow to complete so a useful exercise!