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 Automate
Answered

How do I use Do Until

(0) ShareShare
ReportReport
Posted on by 16
Hi everyone.
I have set it up to do the following:

When a sales invoices in business central gets created get the entry and set the variable of the Sales Invoice nr,
Business central posts Sales Orders directly in Posted sales invoices and Sales invoices runs automatically even if not posted...

So I have set a decision to see if Variable contains "Inv", because Sales Invoices is "IN-12345" and Posted Sales Invoices is "INV-12345"
So if true - Gets invoice from Posted Sales Invoice
If False - Do until ( Delay 30 minutes get record again Set variable to new fetched nr ) - Do until condition is set to the same as the condition above (Stop if No. Contains "INV")
If it contains invoice gets invoice and sends it to the customer.

But for some reason its not working and I am unsure if I am doing it right. See attached.
Auto send emails.PNG
Categories:
I have the same question (0)
  • David_MA Profile Picture
    14,956 Super User 2026 Season 1 on at
    You said, "But for some reason its not working..." However, you do not explain what is not working. Can you describe what is not working?
    1. Is the delay not waiting 30 minutes before it tries again (not, it will retry 60 times before it times out).
    2. Is the set variable not working?
    3. Does it not go down the do until side of the condition?
     
    Are you getting an error message? If so, what error are you getting. Instead of a screen shot of the flow that does not show the configuration of the actions, could you add a screen shot of a flow run so we can see which actions ran?
  • CU01021823-0 Profile Picture
    16 on at
    Hi sorry, yes I should have been more clear. 

    So once it goes into the loop it keeps going 30 min 30 min, then if I post it (It should end the loop and send the invoice), but instead it keeps going until my loop is done and then continues if condition is met or not...

    So I tested it by removing the 30 min delay and it basically runs all 48 counts and then continues with the rest of the flow (Even if it should end then.)

    Does this make more sense?
    Dountil.PNG
  • wyattdave Profile Picture
    493 Moderator on at
    Sounds like you are saying that it the escape condition is not triggering, so even when inv is in the INV number it continues. But that condition never changes unless the set variable removes the "Inv". What value does the set variable set. You could change the condition so that it checks the output of the Get Record (V3), that would be a little neater and ensure you escapes when you get what you need.
  • Verified answer
    CU01021823-0 Profile Picture
    16 on at
    Hi, I think my issue was that the "Contains" was not caps like the value is... I thought contains does not check for capital...

    So I had it set to contains Inv instead of contains INV.
    So it seems to be working now. What would happen if the 24 hours ran out and the condition is not met? Will it just stop the flow there or not?
    Or do I need to set a condition after the Dountil and check again and filter True to send the email?
  • wyattdave Profile Picture
    493 Moderator on at
    We've all been burnt with exact match. After tine the flow continues so you will need a condition and terminate.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 377

#2
11manish Profile Picture

11manish 279

#3
David_MA Profile Picture

David_MA 234 Super User 2026 Season 1

Last 30 days Overall leaderboard