Hello everyone,
We have many workflows planned by external signal or by schedule, and sometimes we have errors that cause the workflows to fail, is there any way to rerun the workflows all at once without having to go in one by one and do it manually?
Thanks in advance
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @LAR1985 ,
You can create a Query to select all the Paused workflows which you need to restart. Then have a JS and write a QueryDef (Links provided in pervious replies) and have the below script to restart the workflow and execute the pending task of the scheduler
To Restart the Workflow:
xtk.workflow.Restart(id)
To Execute the scheduler
xtk.workflow.Wakeup("internal_name_of_the_workflow");
You can try to pass the internalName of the workflow and workflow-id dynamically in the queryDef. So the workflow will start running and execute all the activities at 15:00, instead of waiting till next day's 10:00
Hi @LAR1985,
You can create a monitoring workflow with conditions to selectively restart workflows that have failed, or restart all workflows if needed.
To do this, use the following command in a JavaScript activity:
xtk.workflow.Restart(id)
This allows you to restart any workflow by providing its primary key.
For more information and reference examples, you can check out these discussions:
Thanks
Sushant Trimukhe
Thanks @SushantTrimukheD for your answer, this function will be very useful for us.
From here my next doubt would be, that using that, I understand that we set the workflows ready for the next execution, that is, if they have a schedule node, it will run on the next planned date and if it has an external signal, the next time the predecessor that generates the signal is activated,
Isn't there any way to run the workflows to recover the lost executions other than opening the workflows one by one, remove the schedule or external signal node and run manually?
Thanks
Views
Replies
Total Likes
You can use Start function to resume the operation.
xtk.workflow.Start(id)
Thanks @_Manoj_Kumar_ for the help, but I am sure that this function would be useful. The problem we have is that for example, if we have a workflow planned to run every day at 10:00 with a schedule node and for example it fails and we fix the error at 15:00, if we want it to run again without waiting for 10:00 the next day, we do not see a way to do it without modifying the workflow. If we use the start function, I understand that it would be ready to run at 10:00 the next day, but not at that time.
If this happens with one workflow, nothing happens, but if it happens with 40 workflows, modifying and executing all of them is a very time consuming task.
Views
Replies
Total Likes
Hi @LAR1985 ,
You can create a Query to select all the Paused workflows which you need to restart. Then have a JS and write a QueryDef (Links provided in pervious replies) and have the below script to restart the workflow and execute the pending task of the scheduler
To Restart the Workflow:
xtk.workflow.Restart(id)
To Execute the scheduler
xtk.workflow.Wakeup("internal_name_of_the_workflow");
You can try to pass the internalName of the workflow and workflow-id dynamically in the queryDef. So the workflow will start running and execute all the activities at 15:00, instead of waiting till next day's 10:00