web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Approval Process - Do ...
Power Automate
Suggested Answer

Approval Process - Do Until Issue

(2) ShareShare
ReportReport
Posted on by 722
Hello,
 
I have a flow which doesn't seem to work correctly all the time and I am unsure what the issue is and why it works sometimes but not other times. 
 
When a response is submitted from an MS Form, this needs to go through an approval process:
 
1. Responders Manager needs to approve it
2. The Approvers Manager then needs to approve it
3. Then it keeps moving up the chain and asking each approvers manager for approval
 
However, if the managers job title contains Principal, the Do Until is then completed and it should move onto the next action after the Do Until.
 
I have had submissions that have worked perfectly and the Do Until has looped round and followed the correct paths.
 
But, there are also occasions where it doesn't loop back and it moves onto the next action after the Do Until, despite the managers job title not containing Principal.
 
This is how it is currently set up:
 
Variable CurrentUserUPN: Type: String, Value: Respnder's Email
Variable LookupUserUPN: Type: String, Value: Variables('varCurrentUserUPN')
Variable Approval Level: Type Integer, Value: 0
Variable Stop: Type: Boolean, Value: false
Variable Chain Log: Type: String, Value:
Variable Last Outcome: Type: String, Value:
 
In the Do Until:
 
Increment variable: Name: varApprovalLevel, Value: 1
Get Manager: User (UPN): variables('varLookupUserUPN')
Compose Responders Job Title: coalesce(outputs('Get_user_profile_(V2)')?['body/jobTitle'], 'Unknown')
Compose ManagerEmail: coalesce(outputs('Get_manager_(V2)')?['body/mail'], outputs('Get_manager_(V2)')?['body/userPrincipalName'])
Compose ManagerTitle: coalesce(outputs('Get_manager_(V2)')?['body/jobTitle'], 'Unknown')
Compose ManagerName: coalesce(outputs('Get_manager_(V2)')?['body/displayName'], 'Unknown')
 
 
Condition:
 Outputs('Compose ManagerTitle') contains Principal  Or  Outputs('Compose Responders Job Title') contains Principal
 
true: Set Variable: varStop, Value: true
 
false:
 
Start and Wait for an Approval: Assigned to outputs('Compose ManagerEmail')
 
Condition if equal to Approve
 
Set Variable: varLastOutcome, Value: Approve
Compose: 
concat(
  variables('varChainLog'),
  if(equals(variables('varChainLog'), ''), '', ';'),
  outputs('Compose_ManagerName'), ' - ', outputs('Start_and_wait_for_an_approval_2')?['body/responses'][0]?['responseDate'], ' - ',
  outputs('Start_and_wait_for_an_approval_2')?['body/responses'][0]?['approverResponse'], ' - ',
  coalesce(
    outputs('Start_and_wait_for_an_approval_2')?['body/responses'][0]?['comments'],
    '(no comment)'
  )
)
 
Set Variable: varChainLog, Value: outputs('Compose')
Set Variable: varLookupUserUPN, Value: outputs('Compose ManagerEmail')
 
 
 
An example of a run that should have looped back but didn't looks like this:
 
 
I would expect this to say 1 of 3.
 
 
The true path should always be where the flow completes the Do Until path and the last loop would have a tick on the true path.  But the example above, went to the responders manager to approve, which they did, and it carried on past the Do Until.  It should have gone to the approvers manager to approve, then loop back and check their manager, who does have Principal in their job title.
 
Can someone advise if i am doing anything wrong or have a better way of doing this?
 
thanks
 
 
 
 
Categories:
I have the same question (0)
  • rezarizvii Profile Picture
    70 on at
    Hi, hope you are doing well.
     
    Could you please share the condition that you have set for the "until" part of your do-until loop. Your logic seems apt to me which hints that there could be a syntax related issue perhaps.
     
    Please share the condition in the "until" action and let me know. 
     
    Thanks.
  • neill_long Profile Picture
    722 on at
     
    The Do until condition looks like this:
     
     
     
  • Suggested answer
    Haque Profile Picture
    1,390 on at
     
    At the very first place, let's do a silly check, howe we handeld boolean expression. I guess condition evaluation is not happening correctly.
    Could you please show me the "code view - peek code" screen shot of "variable stop" action?
     
     
    Here is what might happen: (Please scroll horizontally to right if you don't see comparison.)
     
    Declaration Evaluation
    Tip-1: I typed false directly on the Value field: false Code view: “value”: false
    Tip-2: I am typing false on Expression window and it auto suggesting me. After typing I pressed Ok.
    Tip-3: If we compare it with Tip-1, where false is not shown as formula but in Tip-3, as we see it is shown as formula. Please note the difference between false and @false (at the rate). If you see Code View in Tip-1, the false value is shown without but here it is with @false
     
     Please check every where where we have Boolean value evaluated, make sure we typed the value through expression window. Power Automate doesn’t evaluate hand-typed Boolean value expression in any condition – bring them via Expression window, whatever “true” or “false”, they must be @true and @false.
     
     

    I am sure some clues I tried to give. If these clues help to resolve the issue brought you by here, please don't forget to check the box Does this answer your question? At the same time, I am pretty sure you have liked the response!

     
  • neill_long Profile Picture
    722 on at
    Hi
     
    I have checked the boolean expressions and updated them so they are @true or @false.
     
    Could the issue be related to the Timeout parameter in the Do Until:
     
     
    Possibly the request gets approved after the 1 hour and this then breaks the do until and it moves on?
  • rezarizvii Profile Picture
    70 on at
     
    That is a very good point, and one that I have never come across before. Could you maybe set the timeout to a different value and test the flow once?
     
    It is very strange that sometimes the flow would work as expected but sometimes it won't. It implies there is nothing wrong with the flow logic itself, but rather an external factor (such as a configuration issue) that is making your flow behave differently in different scenarios.
  • neill_long Profile Picture
    722 on at
     
    After testing this theory, it would appear this was the cause.  If the approval is completed within the 1 hour timeframe, the flow was running correctly and looping round as it should.
     
    If the approval was completed after the 1 hour timeframe, the process moved past the do until.
     
    I have updated the timeout to: P30D.   30 days should be more than enough time for the approver to complete their task, I hope.
     
    thanks for everyones input and advice.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 589

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 284 Super User 2026 Season 1

Last 30 days Overall leaderboard