Tip #1199: Embrace Variables in your Flows

As you begin to use Flow as part of your Business Applications projects, you will discover that it pays dividends to adopt some of the good habits of our coding brethren. This is what I refer to as ‘disciplined development’. The tool adopted may be different but the habits are the same.

Embracing good developer habits will make your life easier in the long term. One such habit is the use of variables. Variables may be unfamiliar to old-school Dynamics consultants used to Workflows as we never had variables to play with. We did with Actions but, like many features of the platform, Actions were not widely adopted. Certainly not as much as Workflows, which is a pity, but I digress…

For Flow, Variables are particularly useful both for bookkeeping and also for debugging. You create a variable with an ‘Initialize variable’ step. This is simply a placeholder for a piece of information. You can also set the initial value, if desired.

Then, as your Flow progresses, you can refer to the variable’s value or update it with the ‘Set variable’ step.

So why is this so useful? Well, rather than having to define a complex value multiple times throughout a Flow (and updating it multiple times as you modify your Flow), you do it once and from then on just refer to the variable. Easy stuff.

For debugging, variables make life easy by showing exactly what value the variable has been set to.

In this case the TweetAuthor variable has been set to our favourite kiwi explorer nz365guy aka Mark Smith. Not buggy at all.

If you are not using variables in your Flow to hold and carry values, you should. Not only will the coders appreciate your ‘l33t skillz’ but it will make working with Flows a whole lot easier.

(Cover photo by Adi Goldstein on Unsplash)

2 thoughts on “Tip #1199: Embrace Variables in your Flows

  1. Driss EL-FIGHA says:

    a very poor article
    apart from a lot of blabla, no trace of how to initialize and use a variable!!!!

Leave a Reply

Your email address will not be published. Required fields are marked *