Deploying workflows
Although you cannot programmatically create workflows using Nintex Workflow 2013, you can deploy exported workflows by using the Workflow web service to publish a Nintex Workflow 2013 export (.nwf) file from a SharePoint 2013 solution package.
Prerequisites
To create the SharePoint 2013 solution package in Visual Studio 2012, you must have the following prerequisites:
-
Visual Studio 2012
-
Microsoft Office Developer Tools for Visual Studio 2012
Creating the solution package
You can use Visual Studio 2012 to create a SharePoint 2013 solution package, by creating a new project from the SharePoint 2013 - Empty Project template provided with Microsoft Office Developer Tools for Visual Studio 2012. For more information about SharePoint 2013 project and project item templates, see SharePoint Project and Project Item Templates.
The SharePoint 2013 solution package must contain, at a minimum, the following items:
-
Export file
A Nintex Workflow 2013 export (.nwf) file, containing a workflow to be deployed. You can either export a workflow from the Workflow designer to create an export file, or you can use the ExportWorkflow service operation to export the contents of a workflow to an export file.
Note: If the export file contains a site workflow, it must be deployed to a SharePoint site; otherwise, if the workflow site contains a reusable or list workflow, it must be deployed to a SharePoint list or document library.
-
SharePoint feature
A standard SharePoint feature definition, scoped to the SharePoint web, actually deploys the export file. The feature should include an activation dependency for the NintexWorkflowWeb feature, included with Nintex Workflow 2013.
For more information about SharePoint features included with Nintex Workflow 2013, see SharePoint IDs for Nintex Features.
-
SharePoint feature event receiver
The SharePoint feature event receiver, an implementation of the SPFeatureReceiver class, interacts with the Workflow web service to publish or delete the workflow, depending on whether the feature is activated or deactivated, respectively.
The FeatureActivated method is overridden by the event receiver, to handle whatever actions are needed to activate the SharePoint feature. For the purposes of deploying a workflow, the PublishFromNWF service operation, or one of its related operations, is invoked to publish the contents of the export file to the appropriate SharePoint site or list.
Similarly, the FeatureDeactivated method is overriden by the event receiver, to handle whatever actions are needed to deactivate the SharePoint feature. For the purposes of the package, the DeleteWorkflow service operation is invoked to delete the workflow, if the workflow exists on the appropriate SharePoint site or list.
-
WCF SOAP client
A Windows Communication Foundation (WCF) SOAP client, generated from the Web Service Definition Language (WSDL) provided by the Workflow web service, is used by the SharePoint feature event receiver to interact with the Workflow web service.
The event receiver
A detailed discussion of SOAP invocation and WCF client implementation is beyond the scope of this document. For more information about WCF client implementation in Visual Studio, see Windows Communication Foundation Services and WCF Data Services in Visual Studio.
Authenticating the solution package
The event receiver needs to create appropriate credentials to authenticate the SharePoint feature when the event receiver invokes service operations on the Workflow web service. You can use one of the three following techniques to create the appropriate credentials:
-
Use a Nintex Workflow 2013 workflow constant
Tip: Nintex recommends this technique.
-
Use hard-coded credentials
The user name, password, and domain can be hard-coded into the event receiver, and used to create a NetworkCredential object.
Caution: Nintex does not recommend this technique.
-
Use default network credentials
The event receiver can use the network credentials of the current security context, provided by the DefaultNetworkCredentials property of the System.Net.CredentialCache object. Authentication issues can occur, depending on a number of factors, such as authentication methodology and network topology.
Nintex recommends that you create a workflow constant in Nintex Workflow 2013 to store an appropriate credential for use.
See Also
Concepts
Operations
Saving and publishing workflows