Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Planner
    • Outlook
    • SharePoint
    • Teams
  • Triggers
  • Resources
  • ABOUT ME
  • Get help with your flow
Menu

Building a state machine in Power Automate flow

Posted on April 5, 2023April 5, 2023 by Tom

“I’d like to send the request back and forth, to return it back to previous approval steps etc, how can I do some state machine in Power Automate?”


Some flows are not a simple, straightforward approval process. Sometimes you need more than just approve or reject, but also the ‘return to previous step’ option. How do you build such flow in Power Automate? A flow that doesn’t move only forward, but can occasionally move also backwards? Something like a state machine that can move between different states?

Utilise the infinite trigger loop

While the infinite trigger loop is often a painful issue, when building a state machine it’s quite useful. Since Power Automate doesn’t have a dedicated state machine logic, you’ll have to build it yourself. And for this you can benefit from the infinite trigger loop.

Instead of a real state machine where you can skip between branches, you can build a flow that’ll be started repeatedly. A flow that’ll contain e.g. a switch, and depending on the request status it’ll go through one of the branches. Once the branch is finished, update the item with the new status. The infinite trigger loop will start another instance of the flow, this time going through a different path.

Power Automate state machine

Since it’ll be multiple flows instead of one, you’ll have to store the ‘shared’ information somewhere in the list. But that’s a small downside for being able to go back and forth in your flow.

Summary

When building a state machine in Power Automate, you can benefit from the infinite trigger loop – once you update an item, it’ll start another instance of the flow. And since it’s a new instance, it can go any of the available paths, depending on some value. Start the flow, do what’s necessary, and change the status. The flow will run again and do the tasks for this new status.


Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Do you know what to do, but not how to do it?

Get The Ultimate Power Automate expressions cheat sheet and translate your thoughts into flows with ease!


There's also the HTTP requests to SharePoint cheat sheet to help you overcome limitations of some standard actions!

Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Didn't find what you were looking for?
Need to adjust a solution to fit your needs?
Or would you just like to get an assistance from somebody with 1000s of hours of experience with Power Automate?

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2023 Let's POWER Automate | Theme by SuperbThemes