RSS

Visual Flow Error Handling Utility Flows

18 Oct
Visual Flow Error Handling Utility Flows

When I start a new project I often want to skip over the preparation stage and dive right into the deep end. For me that’s where the fun is! Along those same lines I have been known to drag my feet with finishing a project, but that’s a story for another time.

So ignoring setting up all the stuff needed to handle errors and immediately dig into the heart of the project often applies to me when I’m writing a new Flow.

And that’s exactly what happened again yesterday. So I asked myself, “Self, how can you make this easier?” (or something like that)

Here is what I came up with: two utility flows

  • One to retrieve the bits and pieces needed for error reporting (and some other stuff)
  • One to do the error reporting.

Happiness is a good report card


Two Utility Flows to Handle All Errors

  • Error Handler Items
  • Error Handler

Two Utility Flows to Handle Errors


The Error Handler Items Flow

Error Handler Items Flow

Variables:

Error Handler Items Variables

This flow does two things:

  1. Fetches and returns an email collection of Users who have been designated to receive error messages
    1. Retrieving Stick on Bridge
    2. I’ve added a custom Boolean field to the User object, “Is Flow Error Recipient,” and have set it to True for Users who should receive error messages
    3. If there are no Users with this field set to True, the Users assigned to the System Administrator profile will receive the error messages
    4. This collection is necessary in the Error Handler Flow if that Flow is to send an email
  2. Returns the name of the User who launched the Flow
    1. Get User Name Formula
    2. This information is not required in the Error Handler Flow, but is made available for the calling Flow to use

Of course if you wanted to make other items available to your calling Flow you could certainly do so. This could be a handy-dandy utility flow for fetching all sorts of things that you may need on a regular basis.


The Error Handler Flow

Error Handler Flow

Variables:

Error Handler Variables

This flow does also does two things:

  1. It constructs an email Subject and Body (that’s what the Text Templates do)
  2. It sends an email to the addresses in the

Parts of an email


What is Gained?

At first blush this solution looks pretty much like the same amount of work as my prior solution where I used a utility flow to fetch the collection of email addresses and a Send Email element to report the error.

Old Error Handling Method

And certainly the number of elements I’m dragging into the Cloud Flow Designer is the same.

Where it saves time and attention is in these areas:

  • The email Subject and Body are generated by the Error Handler flow so I don’t have to create formulas or text elements in each flow to do this
  • If I want to change how the generated email looks I have only one place I need to go (as opposed to every single Flow where I have a Send Email element)
    • This is huge for me as I’m all over the page here – having a single place where these items are structured will make for more consistent error reporting
  • If I want to display the User’s name in the Flow, Error Handler Items exposes that information so I don’t have to create a function to get it
    • If I want the way a User’s name displays to change I have only one Flow to update to make that happen across all Flows
  • If I want to use other items on a regular basis I can use the Error Handler Items Flow to expose them

Save Time Fuzzy Ball

As my knowledge of Visual Flow has expanded I have revamped my error handling a couple times and I can honestly say that just the second bullet point alone is well worth the trouble of revamping it again. So that is my task for today: revisit all the Flows where errors need to be handled and install this method. For me it’s a small price to pay to be able to quickly update my error reporting down the road.

Time to Revamp


Cheers!

 
Leave a comment

Posted by on October 18, 2017 in Flow Tips & Tricks, Visual Flow

 

Tags:

Leave a comment