Skip to main content

Good day,

I built a workflow that creates a folder / sub folder structure when creating a new document set or a new folder in a document library.

The workflow works perfectly when starting it manually on the new document set / folder. The requirements is that the workflow should start automatically whenever a new doc set / folder is created. The problem is that whenever I set the workflow to "start when items are created", the workflow creates the Sub Folders in the document library root, instead of in the new folder. It also shows errors on some of the folders (error message attached).

I would think that there is something wrong with my workflow, but the thing is it works perfectly when starting it manually.

I also tried changing the settings on my action set to "Run as Workflow Owner", but I'm still getting the same errors.

Is there a way of duplicating the manual workflow start action to "start when items are created"?

Hi Henk,

Looking briefly at your error message it appears that the item was changed when the workflow tried to update it. Your WF requirement is not very clear from your description, but would you want to add "Commit Pending Changes" action after you create each of your folder/subfolder?

Regards,

Shrini


Hi Shrini,

Thank you for the reply.

I did try to add "Commit Pending Changes" after each action, but I still get the same errors.

My requirements are:

  • When creating a new folder / document set in the document library, a certain folder structure with sub folders should automatically be created under that folder / document set.

As I mentioned, the workflow works when starting it manually, but as soon as I set it to "start when items are created", then the folder structure gets created in the root path instead of in the new folder. The errors then appear.

Kind Regards,

Henk


Hi Henk,

I have done something similar. I create a folder in a document library and copy attachments to in it.

 

What I did is create a Document Library in SharePoint. In this library I copy in the folders I create.

In my workflow I use a Build string action to build the folder Name (I use a ProjectNum+ID so it is unique). I also created a variable to hold the folder name string. I called it FolderName.

I then use an Update item action to update the current Item with the FolderName variable I created.

Then I used a create item action to create the item in my Document library I created in SharePoint and set my value to FolderName variable.

220495_pastedImage_1.png

 

Then later in the workflow I use a copy to SharePoint action to copy the attachments to the folder I created. In the Destination field I selected "Enter a URL" option and used the link to my document library with a /FolderName to create the new folder with the name stored in my Variable.  e.g. http://intranet/sites/Myprojects/DocumentLibrary/FolderName/

220508_pastedImage_3.png

Hope this can help you.

Regards,

Donovan


Hi Henk,

From what I see you have got some parallel actions which creates folders (I am not 100% sure as I dont whats configured in your actions)but do you want to make them sequential rather than a parallel task, further do you want to add a commit pending changes in the beginning of the WF so that it clears off everything before you start creating anything?

With regards to your folders being created in the root folder, I think you may need to add some troubleshooting logs into your WF (like path where it needs to create etc) and see where the actual issue is?

Regards,

Shrini


After investigation I found the issue:

As the workflow was set to "start when item is created", it started a new instance for each folder that was created by the workflow. This caused various workflow instances to run resulting in the errors and duplicate folder creation.

Seeing that one of the requirements was that the workflow should be started automatically whenever a document set is created, I could not remove the automatic workflow start. What I did was to add conditional starting with the Nintex Workflow Filter Action. I set it to only run if the content type = Document Set. This resulted in the workflow starting only when creating document sets in the document library, and created the folder structure without any issues.

Thank you for everyone's assistance.


Reply