Advertisements
deployment taking a long time

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

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.

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

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

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.

Advertisements

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

  1. 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?

    1. 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.

      1. 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?

      2. 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', '')"
        }
        }

  2. 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?

  3. 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.

  4. 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

Leave a Reply

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

%d bloggers like this: