In this article we will see how to deal with SharePoint Online List Item update event.
For the demo in this article I will consider a business scenario where on update of any Product in the Product list, an approval process will execute and an email is send to approver for the selection of Price Range for the Product just updated.
To start with a demo I have a Product List in SharePoint Online Site as shown below-
Go to “Flow” Menu and Click on “Create a Flow”
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
For this demo we will create a Flow using blank template
Go to Flow Site by clicking “See you flow” links
Click on “Create from blank” this will launch Workflow Designer
On the Workflow Designer, Select the Trigger
We can select trigger from the any of the available services as shown highlighted below-
Select SharePoint Online as target service & select for the Trigger “SharePoint-When an existing item is modified”
Provide the Title to the Workflow “Product Details Modification Approval Request”
Create SharePoint context by providing Site URL and List Name as shown-
You can optionally rename the Step by selecting “Rename” option as shown below-
Here I have changed the name of Step to “Get SharePoint Context”
Add another action to the workflow by clicking “Add an action” option
Send email by selecting “Office 365 Outlook” Service and “Office 365 Outlook-Send approval email” action
Rename the name of Step to “Request Approval”
Choose or approver’s email in “To”, here I am just selecting the email of the person who has originally created the Product in list by choosing “Created By Email” field
Specify Subject as applicable
Specify User Options that allows approver to select the approval options from within the mail
Specify the Body content as required. This content can consist of dynamic tokens provided by Workflow runtime as shown below-
Update List Item by selecting “SharePoint Online” Service and “SharePoint-Update item” action
Rename the step to “Update item”
Specify Site URL & List Name
In Id field select “ID” token provided by workflow runtime. This token represents the List item Id of the item that triggered this workflow to execute.
It is important to note that values to all mandatory fields in the list must be provided. If you don’t want to change the values you can choose same values again.
For Title field we have selected “Title” token that represent current value present in list for the Title field of this item
In “Product Price Range” field choose “SelectedOption” token that will hold the value selected by the approver from within the mail
Once all the Steps are configure as required we can save the workflow by clicking “Save flow”
Click “Done” to return back to the workflow dashboard
On the workflow dashboard we can see the details of services used with in this workflow
Now modify and the Product in Product List and notice the “Product Price Range” field which is currently set to “Low”
Once the Product details has been changed, this will trigger the workflow that we have developed
On execution the workflow we can see a new email hitting the inbox of the approver
Let’s consider the approver submitted “High” as approval option
This action will update the “Product Price Range” field for the list item to “High” as shown below-
Hope you find it helpful.