cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
hkhan
Level: Powered On

Stop Flow in the middle of approval process on condition

Hi All,

 

I have a flow that has 5 level of approvals. The flow workds on SP list with manual trigger. The way it works is that at every level of approval, when an approver gets an email, they also get a link to the item where they can go and add the email address of the approver at next level e.g.

Approve 1 gets email for approval. --> Approver 1 approves and updates the Email field for approver 2. 

 

This way the flow contiues and the approver 2 gets an email automatically. This is to be done at all 5 levels of approval.

The requirements have changed now that there may not always be 5 approvers. Sometimes only 2 or 3 may be needed. 

 

IS there a way I can put a condition that may stop the flow at any level a user would want. I believe the flow cannot be dynamically set to increase decrease level of approvers but maybe some one has an idea of how to create certain conditions that might stop the flow if the next level of approver email field is empty? 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Stop Flow in the middle of approval process on condition

Hey @hkhan That is so bad that flow does not recognise null string. I just replicated the issue at my end it threw the same error to me as you are gtting. Here are two ways I found to solve it.

1. Check the length of the string and if it is 0 then trigger the condition:

expression:

length(variables('hasEmail'))

hasEmail is my variable name please replace this with yours.

2. Check if the string is empty and if true trigger the yes branch and if false then the no branch

expression:

if(empty(variables('hasEmail')), true, false)

In the above expression, the if condition will return true or false and so on the right side n your condition, you should put true. 

Please see the screenshot below:

ys.pngHope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

5 REPLIES 5
Super User
Super User

Re: Stop Flow in the middle of approval process on condition

HI @hkhan 

 

In your scenario as you are getting the email address for the next level approval from sharepoint, I would suggest you initialise a few variables and use them to check if they have a value then proceed to another apporval or else terminate the flow. Please refer to the screenshots below: 

asd1.png

 

asd2.png

Here you replace Base in the variable with the email column of your sharepoint. This is for the first level, and you can similarly replicate for the other levels, too. 

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

hkhan
Level: Powered On

Re: Stop Flow in the middle of approval process on condition

Hi @yashag2255 

Thank you for your reply. I have tried your solution but I am getting the following error:


Capture.PNG

 

Here is how I set my flow:

Capture.PNG

 

Capture2.PNG

 


Even thought the "HasEmail" variable is null it still goes on to to process the wrong branch. 

Capture3.PNG

 

Super User
Super User

Re: Stop Flow in the middle of approval process on condition

Hi @hkhan  Can you confirm what data is coming in the has email variable of your flow? Can you post a screenshot of the flow run on the action set variable and check if something is coming in?

hkhan
Level: Powered On

Re: Stop Flow in the middle of approval process on condition

Capture.PNG

 

Just for the kick...I changed the condition from:

 

 Capture.PNG

 

TO This:

 and it worked. Even though I can see that HasEmail variable is equal to null

Capture2.PNG

Super User
Super User

Re: Stop Flow in the middle of approval process on condition

Hey @hkhan That is so bad that flow does not recognise null string. I just replicated the issue at my end it threw the same error to me as you are gtting. Here are two ways I found to solve it.

1. Check the length of the string and if it is 0 then trigger the condition:

expression:

length(variables('hasEmail'))

hasEmail is my variable name please replace this with yours.

2. Check if the string is empty and if true trigger the yes branch and if false then the no branch

expression:

if(empty(variables('hasEmail')), true, false)

In the above expression, the if condition will return true or false and so on the right side n your condition, you should put true. 

Please see the screenshot below:

ys.pngHope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 336 members 5,317 guests
Please welcome our newest community members: