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.
Comments
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.
Variables
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.
great, I needed this in order to replace Nintex in some sites 🙂
Thanks Luis, I’m glad my post helped you!
Tried this, when the workflow enters the “do until” loop, you can’t see the state of the flow when its running. Any ideas on how to see the current state?
Do you mean the that the State Machine Status isn’t visible? This should be created as a variable within your Flow/Logic App.
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.
I guess you could update a status field in the triggering list item in SharePoint or any other data that may trigger your flow.
OK, thats a work around. I’ll try it and test. I have a workflow with about 10 tasks, so I’ll see if it works.
[…] Office 365 – Flow – Implementing a State Machine using Microsoft flow […]
[…] is actually a second template that is useful when you create a new flow. The State Machine workflow. My previous posts about state machines focused on running a flow multiple times and […]
[…] 2 posts about developing state machines in Flows, will help to run a single flow with a state machine alike process and the template for the state machine can also help you. Of course, Serge Luca’s Flow […]