Nintex is a premium technology partner for SharePoint. With the announcement of SharePoint 2016, Nintex has made the announcement of general availability of Nintex Workflow 2016 on July 11th 2016.
We have earlier explored how to create a list, using Nintex Workflow 2016, by entering the list Creation Information as a list item in a list. Whenever an item is created based on the item column values, the workflow would create a list. You can read the article from here.
In this article, we will be extending the process. We will be adding one more column to the list ‘Delete Site ?’ which will be a Boolean Yes/No field. The list ‘List Operation’ will contain list items, based on which a site is created when the list item was added to the list. Now, when we modify the existing list item’s ‘Delete List ?’ column value to ‘Yes’, it will run a Nintex 2016 Workflow to delete the list. As a prerequisite, ensure that the column ‘Delete List?’ is added to the configuration list, ‘List Operations’ as a Boolean field.
The configuration list along with the columns will look like the image shown below.
The scope of the article will be -
Let’s go ahead to the primary list where we will be running our Nintex Workflow. In our case, it is the ‘List Operations’ list.
Select "
Create a Workflow in Nintex Workflow".
This will open the Nintex Workflow designer.
We can select the actions from the left pane. Before selecting the main delete function, let's add the conditional check to the designer i.e.,
If (‘Delete List?’) == ‘Yes’
In order to do that, right click the designer and select the ‘Run if’ condition.
Once the ‘run if’ action is added, it will show the condition missing warning.
Click on
Configure button in the action.
Within the condition specify the
column name and the value against which the action should run. In our case, the list should be deleted if the column values is ‘Yes’.
Nintex Workflow does not have an action to delete the list directly from the left pane. We will make use of the SharePoint out of the box Lists.asmx service to implement the list deletion operation. Right click within the ‘Run if’ condition and select "
Call web service" option.
It will show the missing configuration values in a warning box.
Click on
Configure option to set up the web service.
The URL option is the primary field that will connect the workflow to the web service.
Click on the
browse option next to the field and get the current Web URL from ‘Common’ tab.
Append “_vti_bin/lists.asmx” to the Web URL dynamic parameter so as to construct the entire web service URL. Enter the site collection administrator credentials in the authentication fields in order to successfully connect to the web service. Click on ‘Refresh’ button to populate the web methods in the drop down.
Select ‘DeleteList’ as the web method. Now, we have to pass the list name as the parameter to the web service. Click on the browse functionality and get the list item’s ‘List Title’ column value from ‘Item Properties’ tab.
Thus, the web service configuration will look like the image shown below.
Hovering over the action will show the summary of the workflow activity.
Now, let’s set the start condition for the workflow. Click on Workflow settings.
Specify the workflow name and description. Set "
Start when items are modified" field to ‘Yes’ so that the workflow will run on item updated event.
Let’s go ahead and publish the workflow.
Make any changes to the workflow name and description before the workflow is published.
The publishing of the workflow has started.
Finally, the workflow has been published.
Now, let’s go to the list and change the ‘Delete List?’ column to ‘Yes’. This will trigger the workflow and will delete the list by the name in ‘List Title’ column.
As you can see, the workflow has run and the status has been changed to ‘Completed’ indicating the successful deletion of the list.
Summary
Thus, we saw how to delete the list conditionally, using web service and Nintex Workflow 2016 in SharePoint Server 2016.