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.
Posts Related:
- How To Add Video Background To Elements In A Blogger Website BlogSpot
- How To Design An Image Gallery For Your Blogger Website
- How to build XLL Add-in for Excel
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.