Starting workflows

You can use a few different service operations from the Workflow web service to start a site, reusable, or list workflow in Nintex Workflow 2013. You can also provide association data when starting workflows.

Starting site workflows

You can use the StartSiteWorkflow service operation to start a site workflow for a SharePoint site.

Starting reusable and list workflows

Depending on the workflow and the target, you can use the following methods to start a reusable or list workflow for a SharePoint list or document library:

Using association data for starting workflows

All of the methods used for starting workflows accept association data. In SharePoint, workflow associations can have workflow-specific association data. Nintex Workflow 2013 uses association data to store default values for workflow variables specified for a workflow. You can override those default values and specify your own values at the time the StartSiteWorkflow, StartWorkflow, or StartWorkflowOnListItem service operation is invoked. For more information, see Using association data for starting workflows.

Scheduling workflows

The StartSiteWorkflow, StartWorkflow, and StartWorkflowOnListItem service operations attempt to immediately start the workflow. If you want to start a workflow in the future, you must instead schedule a workflow to be executed by the Nintex Workflow Scheduler. For more information about scheduling workflows, see Managing workflow schedules.

Example

The following method uses the StartSiteWorkflow service operation to start a site workflow for the current site.

public bool StartWorkflowForSite(string workflowName, string associationData) 
{
    try 
    {
        // Use the StartSiteWorkflow service operation to start the 
        // site workflow for the current site.
        // Note that the SOAP client automatically handles the 
        // XML encoding for the association data.
        var instanceGuid = soapClient.StartSiteWorkflow(
            workflowName,
            associationData);

        // If the service operation returned a GUID, indicating that 
        // a workflow instance was successfully started, return true;
        // otherwise, return false.
        return (instanceGuid != null);
    }
    catch 
    {
        // An error occurred while trying to start the site workflow.
        return false;
    }
}

See Also

Concepts

Workflow variables

Operations

Managing workflow execution

Terminating workflows

Reference

Web Service Reference