Vadim Tabakman

The Create Site action in Nintex Workflow is a great action and you can create a site based off a site template.  The Site Template can be selected at design time.  But there are certain situations where you don't know the template at design time.

The way to do it would be via a web service call to Sites.asmx.  This web service has a CreateWeb web method.

This method, as you can see by following the link, is not well documented.  The parameters it takes are quite straightforward. The only "gotcha" is the template.  This parameter takes an internal template name and not the title that you see when you choose to create a site manually.  So we need to find a way to get the internal name from the title.

Solution

If we can get this to work, this is ideal for a reusable piece of workflow logic.  It just screams of a User Defined Action. 

Firstly, we need to figure out a solution for getting the template internal name from a title.

Again, we can look at the Sites.asmx web service.  It has a method named GetSiteTemplates. The interesting thing with this method is that the method returns an unsigned int.  What we need, is the actual data, but that is returned as an out parameter.  So in order to get this information, rather than using a Call Web Service action, we need something a little more low level.  In this case, we can use the Web Request action.

Web Request

We've configured this specifically for English (LCID = 1033).

Finally, based on a Template title, we need to pull out the name.  We do this with Query XML by querying the XML returned from the web request.

The XPath looks like this: //defaultNS:TemplateList/defaultNS:Template[@Title="{WorkflowVariable:Site Template Title}"]/@Name

The "Site Template Title" will be a variable that we pass in.  This makes this call dynamic.

Finally, we need to make the call to the Sites.asmx web service and call CreateWeb.

Call Web Service

The workflow to test this out is quite simple.  Just fill in some details.

Workflow

Finally, what we need to make sure, is that the User Defined Action has minimal chance of break.  So I put in a bunch of error checking and also a couple of output parameters that when a workflow calls this action, you can store the output results and build your workflow around it.

UDA Call

 

Downloads

Posted by Vadim Tabakman Monday, October 8, 2012 5:25:00 PM Categories: Call Web Service Nintex Nintex Workflow Query XML Templates User Defined Actions Web Request
Copyright Vadim Tabakman
Rate this Content 0 Votes

Comments

Wednesday, February 19, 2014 1:29:33 AM
Alexander

re: Nintex Workflow - Create Site with a Dynamic Site Template

Hi Vadim,

Interesting post on dynamic sites. Do you know if it is possible to use this technique to build sites with a custom template in Workflow Office 365? At this moment Nintex WF for Office 365 doesn't support the technique so I was wondering if this (or something else) could be a (temporary) workaround. 

Regards,

Alexander Broere

Saturday, February 22, 2014 9:19:36 AM

re: Nintex Workflow - Create Site with a Dynamic Site Template

HI Alexander,

Rather than guessing, I'll just say I don't know :).

One of the things on my todo list, is to work on what webs services or REST services are exposed in O365 and seeing if I can call them from a Nintex Workflow.  But I haven't had a chance yet.

IF you figure it out before I blog about it, please let me know :).

cheers,

Vadim

You must sign in to this site to post comments.
Already Registered?
Sign In
Not Yet Registered?
Register





 

Statistics

  • Entries (246)
  • Comments (1725)

Categories