Create Site Collection User Defined Action

Nintex Workflow comes with a Create Site Collection action.  In most scenarios, that would be sufficient.  But there are occassions where you need to it be a little more dynamic.

In the current action, the Template property of this action is a drop down selection which you need to pick at design time.  If you wanted to build a form that a user fills in an requests a site collection, they wouldn’t be able to choose a template because the action, once published would be limited to the template selected during the design process of this workflow.

The workaround, is to use the Call Web Service action, and call the Admin.asmx web service on the Central Admin web app.  This web service has a CreateSite method that is exposed that creates a site collection.  The downside to this, is that in order to run this, your workflow designer (human) needs to have permissions to Central Admin.  This is generally not a good idea.

To protect this, we can put this into a User Define Action, expose all the parameters as Input parameters to the UDA and return a couple of parameters as output.  This has the added bonus of only allowing the UDA to have the credentials needed to perform this called, so the functionality of the UDA is a black box to the person designing the workflow.  To them, this is just another action they can use in their workflow.

You could expand on this UDA and have something like an approval request go out to a SharePoint admin, lettiing them know that a new site collection creation has been requested and do they allow it?.

You’ll see that the UDA is quite simple and take all the parameters the CreateSite web method takes and a couple of output parameters.

Variables

The User Defined Action design itself is even more simple.  6 actions in total, but feel free to add to it.

UDA Design

Then it gets easier, in that the workflow that uses this UDA, you simply drag the action to it:

Workflow Design

To conclude, this is the configuration you would see if you were configuring this UDA.

Action Configuration

Requirements

The User Defined Action uses 2 constants.  “Central_Admin_Url”, which is the base url to the Central Admin site.  “Farm Admin” which is a credential constant, so I don’t have to keep typing it in and if I need to, I can change the constant later without having to republish the workflow.

Downloads

Nintex Workflow 2010 : v2.3.7.0

 Create Site Collection UDA: Download UDAs

Leave a Reply

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