This tutorial demonstrates how to build a leave request workflow using Nintex Workflow for Office 365 and uses two SharePoint apps; a custom SharePoint list called “Leave Requests” and a Calendar.
For a related tutorial, see "Automate leave request notifications" in the Nintex Workflow for Office 365 help.
Create a SharePoint List called "Leave Requests", with the following columns.
Note: For background on SharePoint lists, see this Nintex for SharePoint article.
To create the Calendar, click on the Settings icon in the top right –hand corner and select Add an App. Click on Calendar, and call it “Leave Calendar”.
You may want to create a page for the two SharePoint Apps to sit on. This page will display all the Leave Requests made as well as the leave calendar. To create a page, click on the Settings icon in the top right –hand corner and select Add a Page. Call it “Employee Leave”.
To begin, the page will be blank, so you will need to add the webparts for the Leave Request list and Leave Calendar.
Click on Insert in the Ribbon and then Web Part.
In the Apps category, you will find the Leave Calendar and Leave Requests apps. Click on them and select Add. They will be added to the SharePoint page as a web part.
Click on the Page tab and select Save. Your page should look similar to the screenshot below (my calendar and list is already populated with one approved set of leave).
Navigate to the Leave Request SharePoint list in the Quick Launch menu, click on the List tab and select Nintex Workflow in the Ribbon.
On the Workflow Gallery page, click New list workflow.
Click on Variable in the Ribbon. This variable is going to store the outcome of the approval task. Call the variable “Task Outcome” and select the type Integer. Click Save.
Drag a Send an Email action onto the canvas. Double-click to open the dialog box. This email will be sent to the initiator of the workflow.
In the To field, click on the List Lookup icon. In the first menu, select Workflow Context and the Initiator in the second menu.
In the Subject field, type “Your [leave type] request has been received”.
Note: The [leave type] Insert reference is accessed through the Insert Reference column on the right-hand side of the action dialog box.
In the Email body, add a message. For example: “Your [leave type] request starting on the [start date] until the [end date] has been received and has been forwarded to your manager for approval.”
Note: The [leave type], [start date] and [end date] information comes from the Workflow Context section of the Insert Reference dialog.
Click Save.
Locate the Assign a Task action in the User Interaction workflow toolbox. Select and drag the action onto the canvas below the Send an Email action. Double click on the action to open the dialog box.
In the Participant field, assign it to the Manager. Type “Administrator” into the field.
In the Task Title field, type “Leave request for…” and then add in “Initiator display name” from the Workflow Context section of the Insert Reference dialog.
Notice the Task Outcome section has automatically defaulted two outcome options - Approved and Rejected. These outcomes will be displayed automatically on the design canvas to continue building the workflow.
Note: You have the option to select LazyApproval in the Assign a Task and Start a Task Process actions. With LazyApproval, reviewers can approve or reject items by sending email replies that contain a valid phrase.
The next step is to drag and drop a Send an Email action onto Rejected side of the Task action to notify the Initiator that their leave request has been declined. Double-click to open the dialog box.
In the To field, click on the List Lookup icon. Select Workflow Context and then Initiator.
In the Subject field, type “Your leave request has been declined”. And then in the Email Body field, type “Declined”.
Click on the arrow on the left-hand side Send an Email action. Click Copy.
Click on the Approved side of the Task action, right-click on a drop-zone and select Paste. Double-click on the action to open the dialog box.
In the Subject, change the word “declined” to “approved”. In the Email Body, change the message to “Approved!!”
The final action is Create List Item, which you will find in the Libraries and Lists toolbox category. Drag and drop the Create List Item onto the canvas, on the left-hand side (Approved side) of the Conditional Branch.
In the Target List field, select the Leave Calendar. Once a leave request has been approved, the leave dates will be entered in this calendar.
In the Title field, select Workflow Context, and then Initiator. We also want to coerce the Initiator output to appear as the Display Name. Click on the orange fx to the right of the Initiator menu.
Select the Display Name format and then Ok.
In the Start Time field, select List Lookup, and then Start Date in the Field menu. In the End Time field, select List Lookup, and then End Date in the Field menu.
Click Save.
We’re now ready to publish and run the workflow. Click Publish in the Ribbon and give the workflow a title “Leave Request Workflow”. Automate the start of the workflow, by checking the Start when items are created checkbox.
Close the workflow designer, return to your SharePoint list and add a new item to run the workflow.
Thanks a lot... it work fine..and it give some idea how to work in nintex workflow
Hi,
I have developed the leave application using nintex 2007, My workflow was set to start automaticaly once a leave is created, but i would like to allow the employees to edit their leave applications, i have modified the workflow start and add the option "start when item is modified", to terminate the running workflow a to start the new one, i have added the action at the start "stop workflow". i didn't work properly and the old workflow still running!
is there a solution for this ?
HI Wassim, I have created a new discussion for you in the Learn More space so more people see it! https://community.nintex.com/message/4536#4536
Hi,
One quick question - is it possible to create a multi-line description from the Assign a Task action?
I followed your instructions and everything works until I click the accept button in the task emails and I'm getting
any ideas?
You can remove the "Create a Variable" step; it isn't necessary anymore.
Hi, is it possible to prevent employees viewing other employees' leave requests?
Hi Jesse,
Absolutely. I would suggest using the Office 365 Update Item Permissions action to change the permissions on the item once the workflow kicks off.
Hope this helps.
Alex
Hi Alex,
So, I followed this, and it's all working great except for this same portion of dynamically updating permissions by the workflow.
I'm hoping I'm missing something silly, but have you seen this before?