Microsoft FLOW , best practice?

having used FLOW for some period now , I would like to share my experience , to save others my frustrations !!

Before I start creating flows, I create a FLOW user. flow@domain.xxx  . All updates done to data , is then clearly stamped with : UPDATED by flow. Not all users like to see names of users they feel are outside the process.  It also only have permissions required for objects to be included in flow.

The first step, is a trigger as it has to be, it can be a scheduled trigger , or an event .

MY FIRST MANDATORY STEP , is a check to see who triggered the flow .  You might want to do different things , based on who triggered. Also in some cases with multiple updates in one flow (NO NO !!) You might by accident trigger the flow from the flow…

Strangely it seems to work without re triggers on short flows, but as they take longer time, they re trigger.. So if  Modified by eq flow@domain.xxx  , then terminate. 

MY SECOND MANDATORY STEP , is to define the variables  for what we would call arguments in old fashion procedures.

Each  variable is set to their default value, it is the unchanged input value from the trigger. This means that if code to come can change , or leave as if ased on logic in that code.

MY  THIRD MANDATORY STEP , is the SWITCH. In each item in SharePoint eg. , I have a SWITCH variable that  normally  is «Ok» , but that end user can set to other values to trigger actions from the flow.

On new item typically it would be «new-fix» or something.  The switch then  routes to code required .

In each block in the switch I save files , update in other tables etc etc , but never updates in the item that triggered the flow. Procedure is to  the variables from the second step.

The fourth step, is the to update record in trigger item .  it might not bee needed , but at least it should rewrite SWITCH variable back to ok .

So… some last word : I insert send mail statements, as I would have done with break points. I use create CSV table to send myself a full  csv file of input data . I might even include a «DEBUG» variable, so that I can turn debug on or off without having to modify code.

Flow is not for the inexperience.. but 80% of functionality that you would use flow to create , is type of reminders. When is the certificate no longer valid, when should the HMS report be completed …  and so on..

For simplicity there is a fourth (first of fourth)   selection on the flow button… IF your list , or library contains a date field .  Its «SET A REMINDER» . You are asked for which variable to use, who to remind (email) , and the flow is then generated. EASY entry point , and nice .