Nintex Workflow and Site Templates

​I recently had a requirement to create sites for projects from a custom site template and needed a Nintex Workflow to be available on the newly created sites.

As expected, when I created the template with the workflow included, the workflow would fail on any sites created from the template.  They are there but are in draft form and an errors says they are checked out if you try to publish them.  Regardless, this was not going to work.

After some useful input from Nintex Support (thanks Dee) I finally had success by applying the workflow to the new site after it was created.

In simple terms, my workflow does the following:

  • Create site
  • Read in exported workflow using XML Query
  • Regex to replace &, < and >
  • Call workflow.asmx web service to publish the workflow to the new site

So, in a bit more detail:

Develop the required workflow and export to a file.  Make sure there are no hard-coded paths etc – always try to use item properties where possible.  Save this exported workflow file to a SharePoint library that can be access by whoever is going to be running the creation workflow.  Grab the path to this file while you are there – you will need it in a moment . . .

Read in the file using a QueryXML action.  This is where you need to add the path to your exported workflow file.  Save the results in a multi-line text variable.



Now use Regex to replace the following:

  • & to &amp;
  • < to &lt;
  • > to &gt;


This cleans up the XML format of the file to a state that can be imported.

Finally you need to call a web service.  Use a variable to point at the new site.  If you use a variable here then it will allow you to type in a temporary URL to allow you to select the method of the web service that you want to use.

Web Service = http://site/_vti_bin/NintexWorkflow/Workflow.asmx

Method = PublishFromNWFXml

workflowFile = the variable that you have used above

listName = which list or library you want the workflow applied to

workflowName = the name of the workflow when published

saveIfCannotPublish = boolean (0 or 1)



That is it!

The workflow should now be published to your new site.

This entry was posted in SharePoint and tagged , , , , , . Bookmark the permalink.

4 Responses to Nintex Workflow and Site Templates

  1. Jean-Pierre Huls says:

    Hi Dave,
    Excelent tip. This seems to be for list/library workflows. What about publishing a Nintex Site Workflow via a webservice?

    Kind regards,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s