Prepare for success
- You must have at least the following permissions to complete this step:
- Full Control on the List
- Contribute on the Site
- Read on the Site Collection
For more information, see Understanding permission levels in SharePoint.
Building a leave workflow
Now that you have built your first workflow and have a better sense for some of the design considerations for SharePoint Online workflows, let's build a leave request workflow for your team.
Create a SharePoint list
Create a SharePoint list called Leave Requests, with the following columns:
- Leave Type (Choice – drop down menu) with the following selections:
- Annual leave
- Sick Leave
- Leave without Pay
- Carers’ leave.
- Start Date (Date and Time)
- End Date (Date and Time)
- Description (multi-line textbox)
Tip: If you don't know how to create a SharePoint List, refer to this article (Build a SharePoint list for your Nintex Workflow or Forms 2016) for instruction.
Create a leave calendar
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”.
Add a leave request page (optional)
You may want to create a page for the two SharePoint apps. 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 the page: 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.
- In the Ribbon, click Insert and then click Web Part.
- In the Apps category, you click Leave Calendar and select Add.
- Click Leave Requests and select Add.
SharePoint Online adds both apps to the page as web parts.
- Click on the Page tab and select Save.
Your page should look similar to the screenshot below (The list shown already has one approved leave record).
Build your workflow
To build a workflow
- Navigate to the Leave Request SharePoint list.
- In the Quick Launch menu, click on the List tab and then select Nintex Workflow.
- On the Workflow Gallery page, click New list workflow.
Create a variable
To create a variable
- 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.
Add a Send an email action
To add Send an email action
- 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 drop down menu, select Workflow Context and the Initiator in the second drop down 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, type: 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.
Add an Assign a task action
To add an Assign a task action
- 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. The workflow automatically displays these outcomes 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.
Add a Send an Email action
To add Send an email action
- Drag and drop a Send an email action onto Rejected side of the Task action. This action notifies 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.
- In the Email Body field, type: Declined.
Add another Send an email action
To add another Send an email action
- Click on the drop down 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.
Add a Create List Item action
To add a Create list item action
- Drag and drop the Create List Item onto the canvas, on the right-hand side of the Conditional Branch.
You can find the Create List Item action in the Libraries and Lists toolbox category.
- In the Target List field, select the Leave Calendar. Once a leave request has been approved, the leave dates appear in this calendar.
- In the Title field, select Workflow Context, and then Initiator. We also want the Initiator output to appear as the Display Name.
- Click on the orangefx to the right of the Initiator drop down menu.
- Select the Display Name format and then click Ok.
- In the Start Time field, select List Lookup, and then Start Date in the Field drop down menu.
- In the End Time field, select List Lookup, and then End Datein the Field drop down menu.
- Click Save.
Publish and run the workflow
You're 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.
Check for success
- Where you able to create your leave calendar?
- Where you able to access the Nintex Workflow designer?
- Where you able to publish the leave request workflow?
- Where you able to run the workflow and approve the request?