Mass Resume Line Workflows

14 11 2014

Orginally from my new blog: www.exploreax.com

http://www.exploreax.com/blog/blog/2014/11/07/mass-resume-line-workflows/

<strong>Challenge/Problem</strong>: Many line level workflows that need to be resumed.

<strong>Description</strong>: Sometimes due to data or setups one may have numerous line level workflows failing and entering a “Stopped” state. This may be a result of calendars that do not have enough dates created, users who have been disabled etc… If the workflows were header level, it is easy enough to select all in the Workflow History form and click resume, however on line level workflows one needs to view each line level workflow individually and resume them.

<strong>Solution</strong>: The following job can be used to perform mass resume on stopped workflows. You can adapt the SQL to limit to certain documents or document types of necessary.
<pre>static void resumeStoppedWorkflows(Args _args)
{
WorkflowTrackinStatusTable tracking;
int i, j;
while select tracking where tracking.TrackingStatus == WorkflowTrackingStatus::Faulted
&amp;&amp; tracking.WorkflowType == WorkflowTrackingStatusWorkflowType::DependentSubworkflow
{
try {
Workflow::resumeWorkflow(tracking.CorrelationId, “Auto-resumed”);
i++;
}
catch (Exception::Error)
{
//Some may not be able to be resumed but we dont want to stop the process
j++
}
}
info(strfmt(“%1 workflows resumed, %2 workflows could not be resumed”));
}
</pre>


Actions

Information

Leave a comment