Creating generic flows in Microsoft Flow using the SharePoint connector

One of the differences between SharePoint Designer workflows and Microsoft Flow is the way you can have multiple copies of the same flow for multiple lists and or libraries. Where in SharePoint Designer you would be able to refer to the current list. Flow does not offer this option. Therefore when you create copies of a flow you will find that you are updating the site url and the list name in many different places.

In the past I tried to make sure that my SharePoint actions would use dynamic content or variables however this was never supported as Flow wasn’t able to validate list columns during design time.

Today I tried this again and I found that things worked.

In my flow I started with a When an item is created or modified.

 

When an item is created or modified trigger

 

Then I set two variables a SiteUrl and a ListName. I used the Compose actions rather than the variables connector to do this for performance reasons. However you could consider using variables as that will make your flows more readable. We will see this shortly.

Get the Site Url and list name from the When an item is created or modified trigger

Then within my Get items action I use

outputs('ListName')
outputs('SiteUrl')

and this is where you can see a small problem:

Get items action using the compose output

If you get it wrong you will rely on the hover over tool tips to find out what you did wrong. When you use a variable instead of a Compose action you will notice the difference.

Get items using a variable instead of compose

Now when you create multiple copies of the same flow you can simply update the variables and potentially the trigger and you can copy flows from one list to another within seconds. It woud still be nice if you could get the list name and the site url out of the trigger but at least this is a good start towards creating generic flows.

 

11 thoughts on “Creating generic flows in Microsoft Flow using the SharePoint connector

  1. In this example you are creating variables to be used in subsequent actions. Is it still the case that the trigger is going to be fixed? Meaning it’s value must be changed during each copy? Have you found a way to make the trigger entries dynamic?

    1. Hi Adam, the only option I could possibly see work is by using the options in the flow management connector and replace on URL with another on the way. Manual copying and a single update was easier to implement so far.

  2. Hi, how did you get the listname and url from the trigger? It is not listed in the output? Did you ‘parse’ the item link or use another expression? Thank you.

  3. Hi, I’m just beginning to work with sharepoint. How can I get the site url and listname from the sharepoint trigger action? It is not in one of the provided outputs? Thank you.

    1. Hi Jonm

      The two compose actions get the properties from the trigger.

      The SiteUrl is taken from the SiteUrl property.
      The ListName comes from the ListName property.

      You can select these from the Dynamic contents given by the trigger.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: