Mass Resume Line Workflows

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

Description: 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.

Solution: 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.

static void resumeStoppedWorkflows(Args _args)
{
    WorkflowTrackinStatusTable tracking;
    int i, j;
    while select tracking where tracking.TrackingStatus == WorkflowTrackingStatus::Faulted
&& 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"));
}

Leave a Reply

Your email address will not be published. Required fields are marked *