In this post I will explain how we can Schedule a workflow using Nintex actions.
Let’s create a Nintex workflow which will use workflow actions to schedule a workflow named ‘Fetch Project server Details’
Step-1 Get the Workflow ‘Start From’ Date and Time
To schedule a workflow, we need to get ‘Start From’ Time of Workflow. So, lets use the current datetime as ‘Start From’ time of workflow and format it in “yyyy-MM-ddTHH:mm:ss” such as ”2014-02-14T18:00:00.
Use ‘Set variable’ and ‘Build String’ actions to change the current datetime to desired format. See these actions below –
First, current date is formatted and stored in ‘FormattedDate’ variable. Read it as –
Above action formats the current Time and store it in ‘FormattedTime’ WF variable. Read it as –
Above ‘Build string’ action builds the and stores the final formatted datetime into ‘FormattedDateTime’ variable which will be used while scheduling a workflow in next step.
Step-3 Schedule a Workflow
Finally, to schedule the workflow use ‘Call Webservice’ action shown below. This action schedules the workflow to run every hour from the current time indefinitely.
Nintex provide a webservice _vti_bin/nintexworkflow/workflow.asmx that exposes different methods to perform different tasks, one of them is to schedule a nintex workflow. In the above action, ‘AddWorkflowSchedule’ webservice method is used to schedule a workflow. This method accepts schedule information in an xml format.
Below is the xml that is provided as an input to this web service method which schedules the workflow to run every hour from the current time indefinitely.
<?xml version=”1.0″ encoding=”utf-8″?>
<m:workflowName>Fetch Project Server Details</m:workflowName>