Triggering Microsoft Flow from a SharePoint Designer Workflow

If you’re looking to automate something from a Site Workflow, you might find that an out-of-the-box Action doesn’t exist to accomplish exactly what you need. But with new tools like Microsoft Power Automate (Flow), you can get those items accomplished quickly and easily. But how can we make the SharePoint Designer Workflow trigger the Flow? It’s easier than you might think!

First, you’ll need to create your Flow. From Flow, go to My Flows, New > Create from blank, then Create from Blank again. (They update this screen often… so just be sure to Create from Blank, however you need to get there, instead of creating from a template).

clip_image002

Next in the search box you’ll type the first Trigger we’ll need to add to the Flow: “When a HTTP Request is Received”. Type “Http”, then go ahead and click on that Trigger in the list that appears.
clip_image004

Now within that HTTP request trigger we’ll need to add the JSON Schema that will allow the SharePoint Designer Site Workflow to call this Flow. Add the following text to the Request Body JSON Schema box, as shown in the image below:

{

“$schema”: “http://json-schema.org/draft-04/schema#”,

“type”: “object”,

“properties”: {

“message”: {

“type”: “string”

}

},

“required”: [

“message”

]

}

This will result in this:

clip_image006

Next click on “Show Advanced Options” and select “POST” in the method drop down.

clip_image008

What we’re looking to accomplish is to get that HTTP POST URL box to populate, but that won’t happen until we save the current Flow. But we can’t save the current Flow until we insert at least one Action into it. So we’ll do that next.

Hover below your Trigger box, and a plus sign will appear. Click that puppy and choose “Add an Action”

clip_image010

The world is your oyster here, but the pearl I selected was “Get Items”. This will allow me to capture items from a SharePoint list, and do with them what I wish.

clip_image012

Now that I have done this, I can Save the Flow, which will generate the URL in the HTTP Request section. Copy that URL, and save it to Notepad or some other handy location from which you can grab it later.

Now let’s go into SharePoint designer, and take a look at our Site Workflow.

Specifically, what we’re doing here is calling the Flow in a regular old Site Workflow that advances a Project from one stage to the next. The Actions highlighted in pink below are what triggers the Flow to start.

clip_image014

First we need to build a couple of dictionaries that will be referenced in the Call action.

Insert a “Build a Dictionary” action above your Transition to Stage step. You will add three rows to this dictionary:

The first should be named, “Accept”, set to String, with a value of application/json; odata=verbose

The second should be named “Content-type”, also be set to String, with the same value: application/json; odata=verbose

The third should be named “Authorization”, also a string, but this one should have a blank value. The reason for this is it will force the authentication to the current user credentials – which is what we want.

The result will look like this:

clip_image016

Output this dictionary to a new variable (“Create New Variable”) and call it “requestHeaderDictionary”.

Next create one more dictionary in the same manner as above, but for this one, output it simply to a variable called “Dictionary”, and set one row with name “Message”, String, value = “message”.

clip_image018

Now that we have the dictionaries built, things really get fun! Now we can insert the HTTP Call Web Service action into the workflow. This is where we will insert the Flow URL that we’ve already saved. Insert an action and type “Call” – this will bring up the action you need:

clip_image020

We’ll need to set the two items highlighted in pink below:

· “this” is where the URL will go

· “request” is where our “Dictionary” variable will go – the one with “message” in it.

clip_image022

Once we set those, click the drop down on the right side of the Call action and select Properties:

clip_image024

Here you’ll need to set your RequestHeaders value to the variable we created in the first dictionary – “requestHeaderDictionary”.

clip_image026

That’s it! Now you can publish your Workflow, and when it runs, it will trigger your Microsoft Flow.

There’s so much more that can be customized with this – for instance, you could send a parameter to the Flow from the Workflow by modifying our basic “message” dictionary to include another parameter, instead. For more exciting information on Microsoft Flow, contact Support@PPMWorks.com for assistance. We’d love to help you customize a solution for your environment!