Schedule a Nintex workflow using Nintex Actions

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 –

fn-FormatDate(Current Date,”yyyy-MM-dd”).

Above action formats the current Time and store it in ‘FormattedTime’ WF variable. Read it as –

fn-FormatDate(Current Time,”HH:mm:ss”)

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″?>

<soap:Envelope xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:soap=”http://schemas.xmlsoap.org/soap/envelope/” xmlns:m=”http://nintex.com“>

<soap:Header>   </soap:Header>

<soap:Body>

<m:AddWorkflowSchedule>

<m:fileUrl></m:fileUrl>

<m:workflowName>Fetch Project Server Details</m:workflowName>

<m:startDataXml></m:startDataXml>

<m:schedule>

<m:MaximumRepeats>0</m:MaximumRepeats>

<m:WorkdaysOnly>false</m:WorkdaysOnly>

<m:RepeatInterval>

<m:Type>Hourly</m:Type>

<m:CountBetweenIntervals>1</m:CountBetweenIntervals>

</m:RepeatInterval>

<m:EndOn>NoLimit</m:EndOn>

<m:StartTime>{WorkflowVariable:FormattedDateTime}</m:StartTime>

<m:EndTime>0001-01-01T00:00:00</m:EndTime>

</m:schedule>

<m:updateIfExists>true</m:updateIfExists>

</m:AddWorkflowSchedule>

</soap:Body>

</soap:Envelope>

Leave a Comment

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