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.

Implementing a State Machine using Microsoft FlowIn 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.

Implementing a State Machine using Microsoft FlowFor 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.

Comments

Table of Contents

Implementing a State Machine using Microsoft Flow

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.

 

Implementing a State Machine using Microsoft Flow

 

Renaming actions

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

 

Variables

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

Implementing a State Machine using Microsoft Flow

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

Implementing a State Machine using Microsoft Flow

Then I’m adding a Do Until Action

Implementing a State Machine using Microsoft Flow

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

 

Implementing a State Machine using Microsoft Flow

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

Implementing a State Machine using Microsoft Flow

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

Implementing a State Machine using Microsoft Flow

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

Implementing a State Machine using Microsoft Flow

 

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

Implementing a State Machine using Microsoft Flow

 

 

Avatar for Pieter Veenstra

By Pieter Veenstra

Business Applications Microsoft MVP working as the Head of Power Platform at Vantage 365. You can contact me using contact@sharepains.com

10 thoughts on “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.

Leave a Reply

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

Discover more from SharePains by Microsoft MVP Pieter Veenstra

Subscribe now to keep reading and get access to the full archive.

Continue reading