in the loop specify how you exit the loop<\/li>\n<\/ul>\nThat\u2019s it : \u2013 )<\/p>\n
Here is the whole implementation:<\/p>\n
<\/p>\n
Here is the detail of a specific state:<\/p>\n
<\/p>\n
You can extend each branch (state) if needed by managing the timeout : if the Secretariat doesn\u2019t react on time you can ask it to approve again :<\/p>\n
<\/p>\n
So you get this :<\/p>\n
<\/p>\n
Now I know you next question : how does the system know that when the Boss rejects the document, the request must go to Val or to the secretariat ?<\/p>\n
Indeed in the approval form, we only have 2 buttons so far : approve or reject. I know that custom forms will be available in the future, but in the meantime we need to rely on the comment box in the approval form : if the boss types \u201cVAL\u201d or \u201cval\u201d or \u201cV\u201d, the flow will go to VAL, otherwise it will go to the secretariat. He can even type V or Val followed by a comment. This is totally acceptable until custom forms are made available and I believe this is super important.<\/p>\n
<\/p>\n
One of the downside of this approach you will face with this approach is that the until loop is opaque when the Flow is running, you don\u2019t see what\u2019s going on (please Flow team, fix this asap).<\/p>\n
<\/p>\n
However you can still see the current flow state by storing in a custom \u201cstatus\u201d column in your SharePoint List or Document library. And if you want more (history, statistics, analytics, check one of my previous blog post \u201cFlow approval escalation with analytics\u201c).<\/p>\n
In summary: each state become a branch in a switch. This is simple, easy to implement, easy to maintain, it scales and it works in the current implementation of Microsoft Flow. This approach also scales because can can easily add many states (or branches) and each branch can also be implemented as a Service Flow (nested Flow) if needed.<\/p>\n
\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"
In this blog post, Serge Luca will illustrate how to build flows that need to use a State Machine. Although Microsoft Flow doesn’t have an out-of-box construct for a State Machine – you can build one by using a loop and a switch case. <\/p>\n","protected":false},"author":347,"featured_media":0,"comment_status":"open","ping_status":"open","template":"","power-automate-category":[2836],"power-automate-tag":[],"coauthors":[2913],"class_list":["post-110955","power-automate","type-power-automate","status-publish","hentry","power-automate-category-walkthroughs"],"yoast_head":"\n
How to: State machines in Microsoft Flow - Microsoft Power Platform Blog<\/title>\n \n \n \n \n \n \n \n \n \n \n \n\t \n\t \n\t \n