Dynamic Approvals in Power Automate | SharePoint List based Approval Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone raza here in this video i will show you how you can create dynamic approvals in power automate by leveraging a configuration list in sharepoint the list will drive the approval pattern of your power automate workflow patterns like is approval required is manager approval required who the approvers are depending upon specific criterias so let's check this out in action [Music] we will create an approval process that is based upon an approval matrix the approval will be dynamic based upon the metadata that the user enters in the system let's take an example of a service desk sharepoint list here when the users create a request on the system they pick a request type for each of these request types i want to dynamically define who my approvers are some request types i do not need an approval for some request types i need a manager's approval and the approvers are different for each request type for scenarios like these it is best to create something known as an approval matrix i'll create a list called approval matrix i have my title column which would have all my request types in here i'll add a column type yes no i will call this approval required default i'll keep it as yes i'll add another column again of type yes no manager approval needed i'll add a choice column approval type first to respond and everyone must approve by default i'll keep a desk first to respond and then a column where i can define my approvers i'll pick the person type column call it approvers you can even allow the user to enter groups here i'll click save that completes my matrix now i'll head over to the grid view and start adding all my request types for each of these request types i can decide whether i want approval or not maybe for stationary requests i do not want any approval and the manager approval is only needed for business cards not for the others for computer related issues i want every approver that i define here to say that the item is approved and then finally here i can plug in who my approvers are business card requests goes to james this column which is of type person i can also make it to allow multiple selections so if required i can add multiple approvals as well for example computer issues they go to james and sarah you can even plug in mail-enabled group email addresses and that completes my approval matrix now we need to build a flow that respects this approval matrix and the beauty of this process is if we ever need to make a change all we have to do is come here and change the matrix in power automate we'll start with an automated cloud flow when an item is created in my sharepoint list i've connected to my sharepoint list whenever an item is created in this list the user has to pick the request type and in my approval matrix i have those same request types based on which i need to define my approval pattern so the first step would be to query the approval matrix to get this information to do that i will use the get items action connect to the approval matrix list i need to apply a filter query here i need to query the approval matrix the title column has the request type information so my query would be title equal to under single quotes i need the dynamic content property of request type and that if i search for request request type value now even though i know that this query will return one row from the approval matrix the get items action will return an array i want to only work with that one record so what i will do here is i will add a simple compose action that i will rename to approval info and the input here would be the expression first off i will go to dynamic content and give it the property value coming from the get items action in my service desk i have an approval status column that tracks the status of the approval and i have my approval commands multi-line column the first thing to do is to check whether approval is required or not based on the request type and that information will be held in this approval info object i will add a condition i will rename this condition to approval required here i will write an expression outputs of this action which is called approval info and from this i need the approval required column information so i need the internal name of the column from sharepoint and for that i can simply sort this column and in the url i will get its internal name in the property called sort field so i've just grabbed the internal name of this column i will plug that in right here this column is of type yes no so it will return boolean results of true or false so i need to check whether this is equal to the expression true if it is not equal to true that means no approval is required and if that's the case then i want to automatically set the approval status to approved it's auto approved and to do that in the no branch i will update my item and in here i will change the approval status to approved and the comments would be auto approved by system now in case that approval is required my next step would be to check whether the manager approval is needed or not so in the yes branch since we are going to have a lot of branching logic it's much more readable if you create scopes so i'll add a scope action first this i will rename to manager approval the first step will be to check if manager approval is required or not and for that i will write the expression that connects to the approval info object and here i need the manager approval needed columns internal name so i'll just sort this and break it from sort field plug it in right here if this is equal to true that means managers approval is needed i will get the user's manager i will update the status of the approval to pending manager approval i've plugged in the approval commands and now i will start and wait for the approval for my manager i've plugged in the details of the approval now i'll add a condition to check to see if the outcome of the approval is approved if it is then i will change the approval status to pending approval since it will go to the main approvals i'll put the comments that the manager has provided and if the manager has rejected i'll set the status to rejected and plug in the commands after the manager's approval would be the main approval action that gets assigned to my approvers so i need to ensure that the manager approval was approved before i go to the next approval i'll initialize a boolean variable set it to true if the manager approval was rejected i will set that variable to false and if the manager approval is not needed i will set the status to pending approval now after my manager's approval i will add another scope this will be my main approval which will only begin if that variable has the value true i need my approvers who are in this person type column now the approval action only expects the email addresses of the approvers semicolon separator i will add a select data operation from my approval info object this time i need my approvers column i'll plug in its internal name and here i only need the email so in the mapping head over to switch map to text mode and plug in the expression item of email now i need to start the approval process and for that if i go to add an action and search for approval we have these options now for the dynamic approval part wherein even the approval type is dynamic which is first to responder everyone must approve i have observed some challenges in doing that with start and wait for an approval but we can use create an approval and then wait for an approval that does the same thing so let's do that i'll create an approval here i will switch enter custom value and write an expression which is if equals outputs of approval info i need the approval type so i'll sort it and pick the internal name of this column plug it in right here if the approval type equals everyone must approve this is case sensitive and it has to match your text here if that's the case then i will use basic await all else i will use basic i'll click ok slash value now when i did that if you observe it says approval creation input it requires the data and basically you need an object that at least has these four parameters in there what's the title of your approval who are you assigning it to you want to send the notification and do you want to enable reassignment the title i've plugged in dynamic content here assign to this is where i need to define who my approvers are select action returns an array which will have all the email addresses of my approvers here i need to give the email addresses semicolon separated so i'll use an expression join it needs a collection i'll pick that from the output of select that's my array of email addresses i will join this by semicolon that completes my approval action this i have made it extremely dynamic since i'm even making the type dynamic that's why the complexity here if your approval type is predefined this action won't be that complex and once the approval action is created we would like to wait for this approval action to complete to get the approval id of this action once again expressions outputs of create an approval create spaces are replaced by underscores and here all we need to plug in is body slash name that will give the context of this approval and the flow will go into weight mode after this the steps are literally the same we need to check the outcome of this approval so outcome of wait for an approval if this does not contain reject that means it's approved in that case i will update the item change the status of the item to approve the approval commands i'll pick response summary and if this is rejected i will set the status to rejected and the approval commands again i'll pick the response summary that completes my workflow and i will save my flow now let's go ahead and try out a few of the scenarios let's begin with the easiest one stationary request that has no approval that's required i'll create an item i make that request the workflow has triggered there was no approval that was required so we can see the status is directly going to approved and the approval commands is order approved by the system let's pick business card this one requires approval and first it requires the manager's approval if approved it will then go to the next step which is for james's approval so i'll create a couple of requests one that the manager approves so it goes to james and one that the manager rejects so it never gets to james the request type is business card so it needs that manager's approval and we can see that right here both of these are now pending my manager's approval since i'm the user who's making the request and my manager on the system is sarah here's the first request that sarah gets sarah rejects this one says no the moment this response is received the approval status will directly go to rejected and will never move to the next state sara has rejected this and here are the commands the second business card approval sara approves this this time the approval process will move ahead to the next approver in line which will be picked dynamically in this case it's james based on the approval matrix and we can see that happening live in action the status here has gone to pending approval and here is the business card approval request that has come to james dynamically based on that approval matrix james approves this plugs in as commands once that response is logged the status here should change to approved and here is a summary of the response that james has provided if a request type comes in for computer issue there is no manager approval needed it should directly go to the two approvers which are james and sarah and both of them must approve because that's the approval type it's dynamic in my issue and pick computer issue as the request type and submit my request the moment the workflow triggers we can see the status has directly jumped to pending approval that's because as per the matrix there's no manager approval required so it will directly go to the two approvers which is james and sarah so here is the request that james receives let's say james approves this now even though james has approved it the status is still pending approval that's because the approval type is everyone must approve so it's still waiting for sarah's decision and let's say sarah rejects this so the status now would change on the fly here to rejected and the approval commands has all the information the information that james put in and the information that sarah put in and to prove how dynamic this process is let's take the same use case this i will make some changes manager approval this time is required the approvers i will change it to first to respond and my approvers i will change this to reza and james so i've basically changed my entire approval pattern for requests of type computer issue try and create a new ticket i put in my request the status has changed to pending manager approval and it's gone to my manager in ad which is sarah here is the approval request that sarah has received sarah goes ahead and approves this now the process will move forward to the next set of approvers in line which are james and reza and the first person to respond their decision will be considered final the status of this item has changed to pending approval reza and james would have received the approval request sereza approves this submits as a response this time the process will not wait for james's approval and the approval status has changed to approve and that approval request that james would have received it would automatically notify james about it that approval is already completed that's because raza has already responded 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: 84,222
Rating: undefined out of 5
Keywords: flow approval sharepoint list, power automate approval workflow, power automate approval workflow sharepoint list, power automate approval, Power Automate, Approvals, dynamic approval in power automate, form approval dynamic recipient, approval patterns, sharepoint, reza dorrani, approval workflow in sharepoint, approval workflow, flow dynamic approvers, power automate dynamic approvers, power automate dynamic approver list, flow, flow approvals, power automate approval tutorial
Id: R18_qYVPWl4
Channel Id: undefined
Length: 18min 46sec (1126 seconds)
Published: Mon Apr 04 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.