Tips and tricks for working with Microsoft Flow

I've got a fever for Flow!
Yes, Flow!

I

Love

Microsoft Flow

I don’t know what it is, but I spend a lot of time in it, from small silly Flows to real time savers. I’ve shared a few of my Flows already, and will be sharing more. I may be a little addicted to automation, Flow being the biggest contender, but also other services like IFTTT and Alexa. I share my addiction in this post, check it out.

Being a developer for the last 20 years or so, I found that many of the best practices in development applies in Flow too! No, you don’t have to be a developer to understand what we’re about to run through.

Name your Actions

“Duh, of course, name your actions…” but do you? When you drop actions into a Flow, you get the standard name of that action.

Microsoft Flow Action SharePoint - Get List Items
Typical SharePoint Get List Items action

The title bar of the action is its name (see the blue SP logo above, with the Get items, that’s its name). Why is that important? When you go to use the data from this action later, the dynamic content selector will group its properties by this name. If you’re in a small Flow, this might not be a big deal.

Microsoft Flow dynamic data showing SharePoint get items

If you’re in a bigger Flow, getting multiple sets of data, this can get unruly quickly:

Three SharePoint Get Items actions in microsoft flow

You might say, “well, they’re unique”, and they are! But down the road, do you know what Get items 3 returns just be reading that title? Here’s what happens in the dynamic content selection:

Microsoft Flow dynamic content selectors for three SharePoint Get Items actions

Renaming it will help you know what data belongs to what. To rename, click the menu for the action and select Rename. Rename it to what the end goal of the action is, what is it doing or returning, for instance, Conferences, List of Contacts, SP Contacts, etc. Just make it unique and important to you.

So let’s rename those actions:

Properly renamed actions in MIcrosoft FLow

And now later I’m much happier since the dynamic content selection makes sense.

Microsoft Flow dynamic content selector with proper names

 

Use Variables

This is a developer thing for sure, but it’ll help the non-developer too. Say you have a Flow with a few conditions, maybe a few parallel actions, and you’re writing similar data across multiple actions, like an email message. Or you have a condition where you’re parsing a string, then you need to use the parsed data again within the condition statements. Variables will be your friend here.

Using a variable, you can set the value of it once, like parse a string or compile a message, and then reuse that variable whenever needed. Anything you may use more than once, set it in a variable.

To do so, add the action Variable – Initialize variable into your flow, set the variable name, type, and set the value! (don’t forget to rename the action)

Initialize Variable in Microsoft Flow

In this example, I’m setting the task title to the from address and subject line of the incoming email. I am doing this because I create tasks in a few different places, so I want to make sure they all use the same format. Down the road, if I decide to change the task title, I can change it once and it’ll update all the other locations.

Using the variable multiple times in Flow

Webhooks vs Posting

This will feel very developerish, and it will have some code, but bear with me.

Many data connectors are available in Flow, like Slack and Teams, and they allow for simple posting into their services through these actions.

Microsoft flow post a message to teams

These are great, but consider using an incoming webhook. This will be a more complex actions, for you as the Flow author, but the benefits are greater. Using an incoming webhook, in most cases, gives you additional customizations to give your posts a cleaner, more professional look. Check out this post on comparing posts to incoming webhooks.

More to come!

There will be more to come, for sure, along with troubleshooting and debugging Flows. If you have a suggestion, please share it below and I’ll spread the word!

‘Til next time, Happy Flowin’!

11 thoughts on “Tips and tricks for working with Microsoft Flow

Add yours

  1. Hi David,
    Looking for a way to use a variable defined by me in an expression. For now, I see it can only be used in the Dynamic content that can be added, but not able to add in an expression. Please help!

    1. yes that can get tricky. What I do is go to the Expression tab, and type in anything, like concat(, and then jump to the Dynamic tab, select the field. That should insert it into the Expression. You can delete the concat( piece and do what you need to from there

  2. I am trying to use Flow to meet a user’s requirements to:
    1. copy new items with attachments in List 1 to with attachments in List 2
    2. Update changes made in List 1 to List 2 in the same site

    Setup:
    2 SharePoint list – List 1 and List 2 with same columns (text, choice, metadata).

    I created a FLOW using ‘When an item is created or modified’.

    Result:
    1. requirements met
    2. when a user updates a column in List 1, a brand new item is created in List 2. If a user updates the 3rd time, a 3rd duplicate item is created.
    I have been trying to add ‘Condition’ to part of the Flow but it did not work. I noticed that ‘Condition’ does not have ‘Edit in advanced mode’ but with ‘Add’ only. I wonder if this has to do with the version of SharePoint online. I cannot make requirement to work.

    I searched a number of forums but I have yet been able to meet 2.

    Thank you for any help.

    1. For #1, did you create 2 flows? or just 1 flow? I ask because different triggers act differently. Feel free to email me a screen shot of your flow to david.lozzi at slalom.com

Leave a Reply

Up ↑

Discover more from David Lozzi

Subscribe now to keep reading and get access to the full archive.

Continue reading