Office 365 – Flow – Implementing a State Machine using Microsoft flow

In the past couple of weeks I’ve been using PowerApps, and the overall experience has been great! SharePoint Designer and InfoPath have been replaced by a browser based application that is a lot easier to work with. Of course it is still all very new but the general experience is very good.

Today, I will be looking at Flow. A Flow can be triggered by a lot of things , but for now I will look at a flow that is triggered by a PowerApp.

In the past I wrote Workflow articles about Nintex Workflow and how to setup the workflows. I have always liked the state machine workflows and I was wondering if I could setup my Flows in a similar way.

So If we start with the basics. Adding some tasks. Within Flow there are a lot of tasks available and for Flows related to PowerApps that use SQL Server as their data source I could imagine that there may be a lot of Update row actions in my flows. Flow supports both on-premises and Azure based SQL installations as the “Connect via on-premise (hic) data gateway” indicates.

For small flows it will be quite easy to just stick action after action. But once a few additional actions are added it might be useful to organize the no-code a bit.


As with Nintex, Microsoft has now introduced comments for each step

This makes the workflows already a lot easier to understand and compared to SharePoint Designer workflows this is already a massive improvement.



Renaming actions

Next to adding comments it might also help to rename all the actions within a flow. This helps documenting the Flow without the real need for additional documentation outside the Flow.



Within Flow it is possible to create variables. So I’m adding a Variables – Initialize variable action to my flow.

Within this action I’m creating a variable State Machine Status

Then I’m adding a Do Until Action

The Do Until action I’m configuring to run until my status variable has been set to Complete.


Then Inside my Do until I create a Switch, which can be found in the … More.

Then by clicking on the + between Case and Default  I add all the different states that I want to go through.

Then for each state I’m added a state change:


Time to add the real work into my Flows and my state machine workflow is ready.




10 thoughts on “Office 365 – Flow – Implementing a State Machine using Microsoft flow

  1. No, I mean that once its running, when its in the do until loop, Microsoft Flow doesn’t expand. So its not about the variable, you cannot see the current action the workflow is on – because it just shows the current action as do until.

    So for a production workflow, where the majority of the flow’s work is done inside the do until, its not practical, because you no idea what is the current action.


Please leave a comment or feedback

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.