Nintex Connect

The Official Community Site for Nintex Software Products, including Nintex Workflow 2007, 2010 and 2013; Nintex Workflow for Project Server 2010; Nintex Reporting 2008 and Nintex Analytics 2010; Nintex Forms 2010; Nintex Live and Nintex SmartLibrary.
Welcome to Nintex Connect Sign in | Join | Help

SyncTerminatedWorkflows does not terminate my workflows

  •  04-18-2011, 7:13 AM

    SyncTerminatedWorkflows does not terminate my workflows

    I have a couple of workflows that are out of sync, so I exectued the following command:

    nwadmin -o syncterminatedworkflows -url {myUrl} -verbose -showMissingItems -terminateDeletedItems

    When I go to View Workflow History of the site, I see that I have no running workflows.

    When I go to All site content > Workflows, I see a lot of active workflows. When I click on one of the workflows, I see that the status is "Failed on Start (retrying)", but in the history, the last message is "Workflow was canceled by Systemaccount".

    As I was curious how the command works, I used Reflector to see what happens. When the command executes and decides to cancel or terminate a workflow instance, the function CancelWorkflow is called. This function however, only seems to add a history entry to the workflow instance.

    private void CancelWorkflow(SPWeb web, Guid instanceId)
    {
        try
        {
            SPWorkflow.CreateHistoryEvent(web, instanceId, 3, web.CurrentUser, TimeSpan.MinValue, string.Empty, string.Format("Workflow was canceled by {0}.", web.CurrentUser.Name), "{8B292400-8EF9-458d-972A-3F1F203D4577}");
        }
        catch (ArgumentNullException)
        {
            WorkflowInstance.CloseInstance(web, instanceId, SPWorkflowState.Cancelled);
        }
    }
View Complete Thread
Powered by Community Server, by Telligent Systems