Hello Nintex community
I’ve been working on an approval workflow for documentation managers and my current workflow is working perfectly on single files, whether it’s started on item creation or manually. But since I had to use Document Sets to work on multiple files with appendices, a problem has occurred.
Case 1 : Automatic “Start workflow on item create”
The approval workflow starts on the Document Set AND the files inside. So I have one instance for each file inside the set AND the Document Set item. For exemple, I have 1 Document Set named “Q01015” with 3 .docx files inside. That makes 4 approval workflows in total.
Case 2 : Start the workflow manually
With this method, I can start the only instance of approval workflow on the Document Set without starting it on files inside. If the Document Set gets approved, it gets published with its children. This method is better than the automatic start because it has only one instance of the workflow.
What I really need is a mix of these two cases. Approval workflow for each file inside the set and when all children are approved, publishes the Document Set. Some kind of a loop inside the set that checks the approval status of each children.
Any tips would be appreciated!
Thank you in advance
Yes my mate we have some.
Create relation ship in document set metadata like doc set unique name or id, then when you put your docs there add that id to them. Then when you are starting workflows query that list on content type to choose on which item workflow should start on doc set or document ? If on doc set and doc set approves trigger other workflow which collects documents with doc set id and starts parallel workflows on them.
If you would like some more detailed information i could answer a bit later today
Thank you for a quick answer
I don't know if I understand well. I actually have an ID shared with DocSet and documents inside (column name "DocSetName") which appears on the list view and inside the DocSet. Then in my workflow, at the beginning, I need to have a "Query list" action? With Query list, I can store children items metadata in variables, then how to use them to control the workflow? I'm stuck at how to choose on which item the workflow should start.
To clarify my problem, I need to be able to automatically initiate a workflow on items that are not "Document Sets". So when I create a DocSet with files inside, they have their own approval workflow initiated and when all files in a DocSet are approved, the DocSet is automatically moved to another list or site or whatever. All that without an instance on the Document Set itself.
Thank you for your time
I think I got it. I need 2 workflows, one for item approval, and one who watches if all items in a DocSet are approved. Am I right?
I understand your problem. First of all on new item created or uploaded you need to start workflow which will query with query list which items ar documents but not document sets this you can do on content type column. Then in for each loop using webservice action control call NintexWorkflow\Workflow.asmx webservice with method Start a workflow on list item start approval workflows on that documents which you queried.
Then you need to have column status near documents. And in Approval workflow which you will build separately you after document approval will check is it the last document of this doc set which was approved.
And i that approval workflow to check is it the last document you will do query list with content type for document and id that docset name, and you will count then those status columns which are approved value if all approved do your magic transferring your doc set with documents where you want
OK. So the first workflow with Query List and For Each loop and StartWorkflowOnListItem :
Then the approval workflow which sets status of an item to "Approved" when it's the case.
The last thing I'm stuck with, it's the "count" workflow thing (check if it's the last document in the set). I can't see how it should be built.
I guess it should be easy but I'm really new to nintex & sharepoint.
Thank you again
In the approval workflow, I add a Query List on documents with status "Approved". I'm OK with that. Then I should call another Web Service and start the "counting" workflow? What action can do that?
No problem it is easy. When approval workflow runs on your document u can get doc set name from that document and you can query list on doc set name to retrieve all documents. From query list you can return status field and do foreach to check if values is approved ? If approved continue to next item if not end looping.
I have my query list in approval workflow with statuses of all concerned items. The I put the For Each loop which checks all statuses one by one but I don't understand how to work with it. "If approved continue to next item if not end looping." What should happen if the loop ends? And how should I set the "continue to next item"?
In for each loop you query collection variable. So create another variable approved count and one more total count. From collection action do count items and set total count variable. Then in for each loop add IF statement which will check if this item approved or not if yes add +1 to approved count. after Loop action add another IF statement which will check if approved count == total count if yes then change state to publishing or what ever your state which do some actions on all documents get approved.
Thank you, it's more clear now. However, when all documents are approved (i.e. approved count == total count) the Document Set itself must be moved, not the children one by one. Is it possible?
Yes it is possible. Tomorrow when i will be at work I will write you which actions you need to use. If I remember correct there are copy document or item to other sharepoint location action. Then you will need to set source url and destination url. In one of my projects i was doing it with folders, but doc set is a folder too so you can easily move it too.