I tried searching for site workflow examples on the forum and I didn't see a tremendous amount, so I thought I would write about a simple site workflow that appears to be requested often. The workflow needs to remind the document owner when the document review date is three months away (giving them time to review and update the document).
To run through this blog post, ensure you have a document library in your site called "Procedure". Ensure that this document library has the following columns:
- Review Date (Date and Time: Date Only) - mandatory
- Document Owner (Person or Group) - mandatory
A site workflow does not get created in a list or library, but is accessible though Settings > Nintex Workflow 2013 > Create Site Workflow. The workflow designer will open ready for you to start developing your site workflow.
The first thing we need to do is calculate the date in three months time (as we will be using this to compare to the review date). We will need to save the calculated date into a variable. Create a variable in your workflow of type Date and Time and name as appropriate. In the example below I have named my variable vDate3MonthsAhead.
Add the "Calculate date" action to the design node on the workflow designer. Double click to configure as follows:
Now we have the date in three months time, we can query our procedures document library for all documents where the review date = our calculated date above.
The results returned from the query list action will need to be stored in a collection type variable, ensure you have one created. In the example below I have named my collection variable vCollFilteredRecords.
So I now have a collection of item IDs for the procedures that are due for review in three months time (note this collection could be empty).
For each policy returned, I want to email the document owner and inform them that the review date is approaching. To do this I need to query the item to get some details about the document.
Drag a "For each" action to the canvas and double click to configure. The target collection is the output from the query list (so vCollFilteredRecords in my case) and the Store result in requires a variable to store the item in the collection's ID. I have created another variable of type List Item ID called vListIDProcedureID:
Inside the For each container I am going to query the list of the current item in the collection to get the properties I require, and store in relevant variables which will need to be created:
Finally, I will email the document owner for each item to inform them that the review is due in three months:
The completed workflow looks like this:
Publish the workflow.
Now, the clever bit. This workflow needs to be scheduled to run daily, forever.
Settings > Nintex Workflow 2013 > Schedule Site Workflows > Add Schedule
Complete the schedule as follows: