
Create a Project with Nintex Workflow and BrightWork Web Service
The BrightWork web service is now extended to include the new endpoint, Create Project so that you can use Nintex Workflow to provision new Project Sites.
This allows the user to create projects based on parameters passed in by the user (using JSON) and this service will be called from the parent web.
- https://samplesite/Sites/BWSite/Projects/_vti_bin/BrightWork.svc/CreateProject
- Will create a new top-level project in BWSite.
- https://samplesite/Sites/BWSite/Projects/ProjectA/_vti_bin/BrightWork.svc/CreateProject
- Will create a new subproject under Project A.
The Nintex workflow can be used with the existing Project Request Manager Template but ensure you disable the native BrightWork feature to create a Project from a Request. The workflow could also be employed in a standard SharePoint Custom List. This blog will step through the process of building the Nintex Workflow.
Create Project Nintex Workflow
Step 1 – Define your Variables
The Nintex Workflow needs seven variables defined, three of which are needed for the Web Service Call and four that are needed to create the Project:
Variable | Type |
PostResult | Single line of text |
PostResultMultipleText | Multiple lines of text |
XMLExtract | Single line of text |
ProjectName | Single line of text |
TemplateName | Single line of text |
ProjectDescription | Multiple lines of text |
ProjectManager | Person or Group |
Step 2 – Set your Variables
In Nintex, use the standard Set Variable Action to capture information from the Project Request Form that will be passed to the Project Site.
Step 3 – Build and execute the Web request
Building and executing the Web request requires three actions:
Step 3a – Capture XML containing X-RequestDigest
Create a Web Request Action to capture the X-RequestDigest and store the information in the PostResultMultipleText variable
URL:
https://samplesite/Sites/BWSite/Projects/prm/_api/contextinfo
Content Type:
application/x-www-form-urlencoded
Store Results:
PostResultMultipleText
Step 3b – Extract X-RequestDigest from XML
Create a Query XML Action to parse out the X-RequestValue from the XML captured in the previous action and store the information in the XMLExtract Variable.
XML from Variable:
{WorkflowVariable:PostResultMultipleText}
Output using Xpath:
//*[local-name()=’FormDigestValue’]
Store Results:
XMLExtract
Step 3c – Create Project Site from X-RequestValue
The final step is to create the Project Site using the X-Request Digest and populating the Project with your pre-defined variables:
URL:
https://samplesite/Sites/BWSite/Projects/_vti_bin/BrightWork.svc/CreateProject
Content Type:
application/json
Header Information:
{
“templateName”:”{WorkflowVariable:TemplateName}”,
“projectName”:”{WorkflowVariable:ProjectName}”,
“projectTitle”:”{WorkflowVariable:ProjectName}”,
“projectDescription”:”{WorkflowVariable:ProjectDescription}”,
“useParentTopNavigation”:”True”,
“addToParentTopNavigation”:”True”,
“addToParentQuickLaunch”:”True”
}