cancel
Showing results for 
Search instead for 
Did you mean: 

Workflow Loop

tomoconnell
Champ in-the-making
Champ in-the-making
I have a rule starting a workflow through a script on create/update. This workflow itself updates files, thus triggering another workflow on completion. What and how would be the best way to solve this be.

I had a look through the rule conditions but didn't really know what to do
or would it be done inside the script, eg "if (node has no active workflows)"

Also, slightly relevant, if a file being routed in a workflow is held and called through bpm_package,
What is the equivalent to a file being handled by a rule?
2 REPLIES 2

niketapatel
Star Contributor
Star Contributor
Hi Tom,

Yes, OOB dont have any conditions that would satisfy your requirement

I would suggest to do it, in script itself from where you are inititating workflow.

You can do below also but that would be generic.If you make that check then user might not be able to start any other workflow
"Node has no active workflow" OR "File in in BPM_package"


Rather than You can check specificically for your custom WF. If it is already active on Content then do NOT initiate new workflow.

You can use below API, you may check for similar JS API

//get all active WF on nodeRef . This will return you workflowInstance
workflowService.getWorkflowsForContent(nodeRef, true);

From workflowInstance, you can WorkflowDefinition and name/id of your workflow.

Hope this help!

I've been playing around with this in JavaScript.

var workflowList = document.activeWorkflows
   if (workflowList.length < 1) {

}

This doesn't check for specific custom workflows at the moment but if I have any more time for this I might come back to it.

Cheers for the help.