SharePoint Online/Office 365: How To Develop Approval Workflows On List Item Add Event Using Microsoft Flows
Microsoft introduces Flows that enables development of Workflows for SharePoint Online and other more than 50 services over the cloud.
In this article we will see the demonstration of Microsoft Flow around SharePoint Online and will deal with List Item Add Event.
For this demo let’s consider we have a Product Catalog List which required Approval to happen with each new item added.
We have a Product List as shown below-
https://howtodowithsharepoint.files.wordpress.com/2017/07/2.png?w=800
Go to “Flow” Menu and click “Create a Flow”
https://howtodowithsharepoint.files.wordpress.com/2017/07/3.png?w=800
Here we have two choices either we can use any available workflow template that suites our requirements or we can create a new one from scratch
https://howtodowithsharepoint.files.wordpress.com/2017/07/4.png?w=800
For this demo we will create a Flow using blank template
Go to Flow Site by clicking “See you flow” links
https://howtodowithsharepoint.files.wordpress.com/2017/07/5.png?w=800
Click “Create from blank” this will launch Workflow Designer
https://howtodowithsharepoint.files.wordpress.com/2017/07/6.png?w=800
On the Workflow Designer, Select the Trigger
We can select trigger from the any of the available services as shown highlighted below-
https://howtodowithsharepoint.files.wordpress.com/2017/07/7.png?w=800
Provide the title of the Workflow
Select SharePoint Trigger “SharePoint-When a new item is created” that will fire when a new item is added to SharePoint Online List
https://howtodowithsharepoint.files.wordpress.com/2017/07/8.png?w=800
Provide Site Url and List name to setup SharePoint context
Add an action to the Workflow by clicking “Add an action”
https://howtodowithsharepoint.files.wordpress.com/2017/07/9.png?w=800
Select approval action by selecting “Outlook.com – Send approval email”
https://howtodowithsharepoint.files.wordpress.com/2017/07/10.png?w=800
Select “Approver Email” in “To”, since this “Approver” is a People Field on SharePoint,
Workflow designer is intelligent enough to represent each property as a separate field
https://howtodowithsharepoint.files.wordpress.com/2017/07/11.png?w=800
Add a condition to the workflow by clicking “Add a condition”
https://howtodowithsharepoint.files.wordpress.com/2017/07/12.png?w=800
In the condition we are check if Approver Approved the Production or not.
If Approved then send approval email to requestor else delete the Product and send Email to requestor
https://howtodowithsharepoint.files.wordpress.com/2017/07/13.png?w=800
Choose “Created By Email” field in “To” as it will hold the Email Id of the Requestor (Person added the Product)
Choose “Approver Email” field in “CC” to send a copy of the mail to Approver also
https://howtodowithsharepoint.files.wordpress.com/2017/07/14.png?w=800
If not approved, delete the Product by choosing action “SharePoint – Delete item”
https://howtodowithsharepoint.files.wordpress.com/2017/07/15.png?w=800
In the “Delete item” action specify SharePoint Site Url and List Name
Select “ID” token for the field “Id”. This token will hold the ID of the List Item that trigged the Workflow
https://howtodowithsharepoint.files.wordpress.com/2017/07/16.png?w=800
After deleting the item we, send email to Requestor by choosing “Created By Email” in “To” field
Specify the body of email as desired
Choose “Approver Email” field in “CC” to send a copy of the mail to Approver also
https://howtodowithsharepoint.files.wordpress.com/2017/07/17.png?w=800
Once all the actions are configured as required save the workflow by clicking “Save flow”
https://howtodowithsharepoint.files.wordpress.com/2017/07/18.png?w=800
With this we are all done and now it is time to test the workflow
To test the Workflow, add a new item in the Product List. Specify Title and Approver and Save the Product.
Save action will trigger the Workflow that we just created
https://howtodowithsharepoint.files.wordpress.com/2017/07/19.png?w=800
As a result of Workflow execution Approve will get the Email with “Approve” and “Reject” options
https://howtodowithsharepoint.files.wordpress.com/2017/07/20.png?w=800
Beauty of this implementation is that Email contains clickable options for approver to submit the approver’s choices from within the email
Here Approver rejects the Product
https://howtodowithsharepoint.files.wordpress.com/2017/07/21.png?w=800
As a result of this Rejection, the workflow will delete the Product from the List and send an Email Notification to Requestor and Approver informing same.
https://howtodowithsharepoint.files.wordpress.com/2017/07/22.png?w=800
Product has been deleted from the list
https://howtodowithsharepoint.files.wordpress.com/2017/07/23.png?w=800
Now again add a new Product to the list that will again trigger the event to execute the workflow
https://howtodowithsharepoint.files.wordpress.com/2017/07/24.png?w=800
Product has been added
https://howtodowithsharepoint.files.wordpress.com/2017/07/25.png?w=800
As a result of Workflow execution Approve will get the Email with “Approve” and “Reject” options
https://howtodowithsharepoint.files.wordpress.com/2017/07/26.png?w=800
This time Approver approved the Product
https://howtodowithsharepoint.files.wordpress.com/2017/07/27.png?w=800
As a result of this Approval, the workflow sends an Email Notification to Requestor and Approver informing same.
https://howtodowithsharepoint.files.wordpress.com/2017/07/28.png?w=800
Hope you find it helpful.