deployment taking a long time

Microsoft Flow – Deploy flows to all your project sites, or maybe not!

Have you had a need to deploy flows to many sites?

In the past a common challenge has been to deploy SharePoint Designer or Nintex workflows to document libraries in all of your project sites. The deployment can take a long time. When you want to make a small update to all projects sites as you discovered an issue with your workflow you might have to wait a while before the fixes have been deployed.

Deploy Flows vs Deploying Workflows

And even though Microsoft Flow doesn’t deploy into your SharePoint sites. You will find that with Flow your flows need to be connected your lists and libraries when you want to make your flows available on all of your libraries.

When these flows are  flows that you manually trigger then you actually don’t have to create multiple copies of your flow.Manually Trigger Flows

Column Formatting to start a flow

With column formatting you can create a link to a flow. This can give you a link in your lists that will look something like this:

SharePoint Column formatting

All you need to do is configure your column with some json as shown below:

{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "span",
"style": {
"color": "#0078d7"
},
"children": [
{
"elmType": "span",
"attributes": {
"iconName": "Flow"
}
},
{
"elmType": "button",
"style": {
"border": "none",
"background-color": "transparent",
"color": "#0078d7",
"cursor": "pointer"
},
"txtContent": "Send to Manager",
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\": \"183bedd4-6f2b-4264-855c-9dc7617b4dbe\"}"
}
}
]
}

Now imagine that you have 1000 project sites and all of these project sites have some lists and libraries that have workflows (Also include Nintex workflows here!) or Flows that start manually from a menu.

Flows from menu

To deploy these kind of Flows to all the sites, could quite quickly give you a management headache as you will need 1000 Flows. One connected to each library.

With the column formatting option however you can have a single instance of a Flow being called from all Flows. Ok, that is easy isn’t it?

Well trouble is starting here.

When you run start the flows from the column formatting provided link your flow will start (if you are an owner of the flow that is). However the authentication doesn’t seem to give you all permissions that you would like. I found that when you call your flow and try to run any action within SharePoint you get all sorts of error message.

The only way to make this work however is to use two flows.

Two flows to replace the need to Deploy Flows

The first Manually started flow will start with a Manual trigger:

1st Flow

The second flow starts when a HTTP request is received.

2nd Flow

And now we can do things to SharePoint without any failure.

This will help a lot.

We only need to have one copy of the flows. There is hardly any deployment needed. Just the column formatting needs to be deployed. Once you’ve deployed the column formatting you can update your flows in a single place.

14 thoughts on “Microsoft Flow – Deploy flows to all your project sites, or maybe not!

  1. commented on April 30, 2019 by Henrik

    Just want to remind that to be able to use the custom HTTP action you need to have Flow Plan 1 or 2.

    https://techcommunity.microsoft.com/t5/Office-Retirement-Blog/UPDATED-Updates-to-Microsoft-Flow-and-PowerApps-for-Office-365/ba-p/289589

  2. commented on July 26, 2019 by Fiona Harrison

    Can you please give some examples for each of the steps in the workflow.
    Thanks

  3. commented on October 23, 2019 by Jimmy Winberg

    Im trying to get this to work.
    I want to trigger the flow using manually trigger and get the data for the selected item and post that data back to the second flow. So i need to get the item id and the list url. Is this even possible?

    • Hi Jimmy,

      This also gives you more information on how to do the column formatting and sending the parameters:

      https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting

      I actually ended up using a WorkPoint ( https://www.workpoint365.com/products/workpoint-365/ ) based solution where we called a PowerApp and the Powerapp would then start the flows for us, but the idea is similar. However WorkPoint did make it easier to pass in the parameters.

      • commented on October 24, 2019 by Jimmy

        Thank you for answering. Im pretty new to this.
        But do i understand it correctly if i say that in my column formatting i should be able to collect the url and item id and forward this to the new flow?
        is it in the txtcontent @currentfield?

      • you can also refer to other than the current field by using a construction like shown below for due date. just make sure that the data needed is in a field.

        {
        “$schema”: “https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json”,
        “elmType”: “div”,
        “debugMode”: true,
        “txtContent”: “@currentField”,
        “style”: {
        “color”: “=if([$DueDate] <= @now, '#ff0000', '')"
        }
        }

  4. commented on October 26, 2019 by Jimmy Winberg

    Thank you so much for answering.
    So i figured out how to get the item ID, itemURL, fileName and FileId.
    Im wondering how can i get the List id or list name and Site Address? Just like the trigger When an item is created provides?

  5. commented on October 27, 2019 by barbieaction

    Thank you i ended up using split and compose as the itemURL contains everything i need 🙂 Really cool post and it has helped me a lot.

  6. commented on October 29, 2019 by Jimmy Winberg

    Do i have to share the first flow with all users that should be able to trigger it? Seems i have to make them owners for the flow to run? This is the first flow with manually trigger that i have in the sharepoint list. Getting an error if i dont share it with the user and make the user a owner of the flow

    • I think that the answer is yes.

      We ended up with a PowerApp letting users select the flows from a drop down in the app. This then avoided this problem

  7. commented on April 24, 2020 by E

    HTTP is now premium… This brings an additional challenge…

    • Hi Elia,

      It does indeed mean that there is an additional cost. But imagine how much it costs to deploy a workflow to 1000 sites.

Leave a Reply

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

%d bloggers like this: