Microsoft Flow is a great tool for automating tasks, and it boasts many options to make your life easier when it comes to those repetitive tasks. Today we’ll take a look at the best practices for Microsoft Flow consultants should have in mind when implementing their Flow solutions!
1. Start Small!
It might be tempting to start implementing all the things you need in your workflow—however, this approach is prone to errors, and errors have a way of building up on each other. One of the key best practices for Microsoft Flow is by starting small, then build on what you have. And, instead of starting with a custom workflow right off the bat, go through templates and see what’s already there!
2. Use Templates!
If it’s not broken, why fix it, right? If you notice that a lot of your workflows are similar, and you think you’ll be creating more workflows that follow that same pattern, you can save your workflow as a template. That way, you can simply use that same template when creating similar workflows, saving you from entering all conditions and actions over and over again.
Just go to Create Process and choose New process from an existing template!
3. No Infinite Loops!
If you’ve ever coded anything, you’re probably familiar with Infinite Loops and what a headache they become. And even though Flow involves no programming, you’re still not safe from those infinite loops.
How can they occur, then? Well, imagine that you’ve configured a workflow to start when an attribute is updated, and then have it update that same attribute within the workflow’s logic. This update action will continue to trigger the workflow that updates the record, which then triggers the workflow that updates the record again, and again—to infinity (but not beyond).
Any workflow you create will include logic to detect and stop these infinite loops and return error messages for when they occur. As such, your process will fail, and you will be able to go back and fix the workflow logic—but it’s always good to know why and what causes infinite loops so you can avoid them in the first place!
4. Child Workflows!
Similar to using templates, child workflows can be saved. So if you find yourself using the same logic in different workflows or conditional branches, you can define that repetitive logic as a child workflow.
For instance, imagine you want a workflow that posts an image across all your company’s social media channels. Rather than writing different flows for different apps, you can save it as a child flow and save yourself the trouble from creating it over and over again. This way, you can just update that one workflow instead of several every time you want to apply a particular logic.
5. Only Make Database Changes at the End of a Flow
Flow comes with certain hard limits (such as the ones that handle the infinite loop situation above). To avoid running into them, keep your database changes to the end of the flow. This ensures the logic happens first, with creations, updates, and deletions sticking to the end. When you have logic issues, you’ll find them quickly, and when you have issues pertaining to writing to the database, you’ll know your beginning logic is safe, and it’s the end you need to work on.
6. Save! And then Save Again!
We’ve all had an app crash on us at the most unexpected of times. This is especially more common if you work on the cloud—an event like losing internet access can set you back hours of work if you haven’t saved.
So when using Flow, save you work. Save as often as you can! Ctrl+S (or Cmd+S) is your friend!
7. Save Disk Space and Set Completed Workflows to Automatically Delete
If you’re running background workflows (also called asynchronous workflows,) it’s highly recommended that you check the box for automatically delete completed workflow jobs in the workflow definition.
This will let the system delete workflow logs after they’ve been successfully completed, saving you a lot of disk space. And if your workflow doesn’t complete, rest assured: failed executions are always saved for troubleshooting purposes.
8. Keep Error Logs
The other type of workflow is the synchronous: the kind that does not run in the background. For these types of workflows, you should keep logs for workflow jobs that encountered errors option checked in the definition.
This will save logs from failed executions for troubleshooting, while successful executions will have their logs deleted to save space. And remember, deleting successful execution logs always happens in synchronous executions!
9. Limit the Workflow Updates on the Same Entity
Needless to say, running more than one workflow that updates a certain entity can lead to resource locks. So if you need to work on that entity, be sure you’re not executing multiple workflows that update that entity.
In the event that you do make this mistake (it happens!) and end up with resource lock issues, errors of the event will be recorded, such as, SQL Timeout: Cannot obtain lock on resource name.
10. Track Changes in Notes
OneNote is an incredibly useful app, and when you edit workflows, you should keep track of what you’ve changed and why. OneNote is fully integrated into the Microsoft environment, so other users can see your workflow-related Notes, and easily understand the changes you’ve made.