Power Automate Multi Level Approval Workflow | Serial Approval | Multiple Approvers

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone reza here in today's video i will show you how to build multi-step approval workflows or serial approval workflows the approval flow that we will build will ensure that both the number of approvers and the sequence of the approvers are dynamic based upon specific criteria so let's check it out in action the use case here is expense reporting i have a list in sharepoint wherein users can enter their expense details i have a column called approval status of type choice i have four choices defined new pending approved rejected the default value is new now to build multi-step or serial approvals the way we typically build this is in power automate since i need the flow to begin when a new item is created i will use the automated cloudflow when an item is create a trigger we'll connect it to my site and list now to create multi-step approvals we will use the start and wait for an approval action this approval needs to go through approvers serially if you look at the approval type all the four options that are provided here none of them apply the approval action to your approvers in a serial fashion and in order to build this pattern we add additional start and rate for an approval action so for example when this process begins for the first approval action i will select one approver so i'll pick first to respond and let's say this is my expense approver one and here i pick reza as the approver then we check the outcome of the approval by adding a condition and checking the outcome property if it is equal to approve if yes then we want to go to the second step of the approval so once again we use start and wait for an approval so this will be my expense approver two let's say my process requires sarah to be the second approver once again add a condition to check the decision that sarah has made i'll pick the outcome if it's equal to approve i want to move ahead to maybe the third approver in sequence and so and so forth now this pattern of adding an approval action and checking the output then based on that starting a second action and so and so forth is good if you have a defined list of approvers so the pattern that i will be showcasing now is ideal for dynamic multi-step or serial approvals because i need an array of my approvers in this case i'll add a new step and i will initialize a variable i'll pick the type array and in here i will define my approvers so a simple array that has the email addresses of my approvers in the order in which they need to have the task assigned to them now once the item is created in my expenses list the first step is i want to go ahead and update the status of the item so i'll pick the update item action for the identity i'll pick the id from the trigger any mandatory fields i would have to refill in so i'll just select the dynamic content from the trigger itself and the approval status value i will set this to pending because i will be starting the approval process now since this is a multi-part approval if any one approver rejects it i would like to set the status to reject it and stop the approval process that is any further approvals in the sequence defined will not be assigned to that approval action so in order to do that i'm going to create another variable i'll call this var status the type would be string but i will initialize it to pending now comes the part of serially assigning the approval action to the approvers in the order in which they are defined in this array i will add and apply to each loop here i need an array i have an array of my approvers i'll just pick that variable i need to start the approval action only if this variable is not equal to the value rejected now we will set that variable to reject it inside this for loop if any of those approvers in sequence once they get the task assigned reject the approval i'll add an action and add a condition and the condition is that the status variable should not be equal to rejected in the yes branch i will add the start and wait for an approval action i'll pick first to respond i'll call this expense approval 4 and i will pick the title now who do you want to assign this task to this i want to assign to the approver the information for which is already available for me inside this for loop since i'm looping through my array of approvers so to get the current item value in assigned to i will go to expression and use the expression item i can provide some details about the approval i'll add a link to the item now the moment the flow reaches this point the first approver in my approvers array will get an approval task and the flow will wait for that user's response right after this action i need to check the response that the user has made so i'll add a condition and i will check the outcome of this approval outcome is equal to approve now if the user rejects it it will go to the no branch and in this case i want to do two things first here i will update that same item with the approval status as rejected and right after this i will set a variable which is my status variable to rejected now if it is approved i would like to set the status to approved only if this is the last approver in my array of approvals i have to check the index of the current running item in the for loop so to get that i will initialize another variable we'll call this our counter variable type integer start with zero now inside the apply to each loop i would like to increment this counter so right after my approval action here i will add an action and use the increment variable action i can pick my variable counter and i'll increment this by one now when an approver approves it i will add an action once again a condition and here i need to check if the length of my array of approvers and i can do that by going to expression typing in the function length and in this it needs a collection or an array so i will go to dynamic content and pick my variable of approvers i'll say okay here i'll pick where counter if this matches that means this is the last approver and if it is the last approver i would like to set the status to approved so once again i have my update item action the only difference here is i'm setting the approval status to approved now that completes my flow let's go ahead and test this out i'll click save my approvers here are reza and sarah so i'm logged into sharepoint with the user james create a new expense item so james has put in the expense details click save the status by default is new and once the approval process begins this status will change to pending so the status has changed to pending and our first approver in our array that we had defined in the flow which is reza would have received the approval notification so here's the approval task for reza whereas i can see all the details and let's say reza goes ahead and approves this and click submit so the approval decision for reza is now logged now the next approver should be assigned the task in sequence and in this case the next approval was sarah and here is the approval task that is assigned to sarah so sarah also goes ahead and submits the approval decision and back to sharepoint status has changed to approved now this pattern is dynamic in nature if i need to make a change all i have to do is just add an additional approver email right here in this array so here i've plugged in james's email address before reza and sarah in my approvers array so now i'll have a three-tier approval process let me go ahead and save this flow so this time signing in as sarah sarah will create a new expense request sarah puts in the details and submits the request the moment the approval process begins the status changes to pending and this time the task will be first assigned to james and james receives the first approval email as we can see right here so james approves this and submits his approval response the next approver in sequence gets the request in this case it's reza and let's say reza goes ahead and rejects the request so now because the status will be changed to rejected including that variable that we created on the flow the next approval will not get the task assigned and the entire process would be rejected we can see that the status here is rejected the next approver and sequence was sarah and if you look at the mailboxes sarah there is no approval notification that has gone out for her that's because no task was ever created now let's take another use case let's say if the amount is greater than 500 dollars then we do need the user's manager to also approve the request so in my flow when i'm creating this array of approvers right after this i will add a new step to check to see if the amount is greater than 500 dollars so i'll add a condition pick the amount if this is greater than 500 then i would like to append the requester's manager as well as one of the approvers and the way i can grab the user's manager is i'll use the office 365 users connector and use the get manager v2 action here i need the email address of the user i can get that by picking the created by user's email address i'll add an action here i will use the append to add a variable action and for my variable of approvers i can insert the mail of the manager that gets obtained by the mail property of the get manager action now this will append this specific email address at the end of the approvers array now since i want the manager to be the first approver i will remove my value and just keep it an empty array and right after this condition i will add an action run and apply to each loop and here i will put in those array of approvers within this i will use the append to add a variable action and for that same variable of approvers i will append the current item now let's go ahead and save and test this flow so i'm logged in as reza i'll create a new expense item the amount that i've plugged in for the expense is greater than 500 dollars in this case i'll click save now once the flow triggers if you look at the condition since the amount was greater than 500 dollars i'll go and grab the user's manager the requester was reza manager sarah it will append it to that area variable of approvers so here's sarah's email then i had my own loop of approvers and here i was appending the approvers one by one into that variable now if you look at the apply to each loop it's going to run three times the first task would be the manager's task which is sarah and here's the approval task that gets assigned to sarah so same flow pattern but we've added an additional layer of approval by getting in the users manager based upon the amount and now to cap this up with a final demo to make this even more dynamic my expense types is a lookup column and based on those expense types i have a column here called approvers and this column is a person or group type column in sharepoint that has multiple selections enabled so here i'm defining my approvers based upon the expense types for the customer expense type i have two approvals for training i have three so my number of approvals are changing based on the expense type plus i can even define the sequence of my approvers right here in this case it starts with reza and goes to sarah if i ever need to change this i can just change the sequence right here and click save now we'll go to sarah and then followed that up by raza now here is my sharepoint list i've just added some column and view formatting to this here is my approval workflow it triggers when the item is created in the sharepoint list i have my variable here called status same as before i'm setting it to pending now to get my approvers array i'm going ahead and executing a query against my lookup list which is expense types and here i have a filter query that says get me those values where the title is equal to the expense type value that the user has selected for the request and this i'm storing it into my array variable of approvers now because the get items action on sharepoint returns an array i know that it will always have one item so i've just gone ahead and added an expression here and at the end i'm using the index 0 to just get the first item and i just need the information from the approvers column which is my person type field multi-select and next i have a select data operation and here i'm just grabbing the claims token of the array of approvers next i update the item but the status pending add information in the approval history column for the approvers column i'm setting its value as the output of select next i have my counter variable then i'm looping through my approvers in this i check to see if the status is not rejected i start my approval action for the assigned to i'm using the email address of the approver that is captured in this array variable of approvers which has the person type column information so i only needed the email that's what i've grabbed here then i also grab the response of the approval i'm storing that in a variable called approval history if the outcome is not equal to approved then i'm setting the status outright as rejected if the approver approves it i go ahead and set the status and the approval history and the status in this case is set to approved only if this is the last approver in my thread of approvals so let's take marketing as an example two approvals here sarah and james so i will create a new expense item i've put in the details here i can even attach receipts as attachments i'll click save here i can see the details of the new request that i just put in the flow has triggered it's gone ahead and set my approvers currently the task is pending to sarah sarah gets the approval notification let's say sarah goes ahead and approves this submits the approval response back in sharepoint we can see live how the status indicator reflects that sarah did approve this and now the task is pending for james's response i even have an approval timeline here if i was to select this it has the complete details right here and this is the approval history column signed in as james let's say james also goes ahead and approves this once the decision is recorded live here in sharepoint we can look at that approval timeline moving ahead and the stat is changing to green and that completes the approval process if any approval rejects it we can even see which approver in the thread of approvers had rejected it if you enjoyed this video then do like comment and subscribe to my youtube channel and thank you so much for watching
Info
Channel: Reza Dorrani
Views: 12,400
Rating: 4.9882007 out of 5
Keywords: power automate multi level approval, power automate multiple approvers, power automate multi stage approval, power automate multi step approval, power automate serial approval, workflow, approval process, flow approval workflow, flow approval multiple approvers, flow approval sharepoint, power automate approval, power automate tutorial, power automate microsoft, power automate approval process, sharepoint approval, power automate, flow, sharepoint, how to, reza dorrani, microsoft
Id: gb_FUeRjgg4
Channel Id: undefined
Length: 17min 49sec (1069 seconds)
Published: Tue Aug 31 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.