The number of actions in a Microsoft Flow is limited to 250. One way to bypass this is to split your Flow in reusable Flows that can accept parameters : that what I’m going to illustrate in this post.
Here is the scenario : I will create a very basic Microsoft Flow that is supposed to be invoked via a RESTFull/JSon interface.
The expected parameters will be the e-mail address, the e-mail subject and an e-mail body.
The “Calling Flow” will read the information from a SharePoint List and will pass these information to the “Called Flow“.
Let’s create a very basic Modern SharePoint List with 3 columns:
Let’s create a Flow that will be triggered when a new item is created in the list.
A list of templates will show-up. Click on “see more templates” and select “Create a Flow from Blank”. Name the workflow “Calling workflow” and select “SharePoint “as the trigger (see next picture).
Select “when a new item is created” then fill in the site url and select the associated list name. You will be asked to provide your Office 365 account credentials to create a connection object.
Next and just to make sure everything works well add an Office 365 Send an e-mail action
Now click on the “Create Flow” button and on “Done”.
Add an item in the SharePoint list and wait for the e-mail to be sent. It can takes between 1 and 15 minutes depending on your Flow subscription (Plan). More details here.
You can also check your Flow history right here (in the Flow portal) (I know we should be able to see that in the SharePoint list directly).
Now let’s focus on creating the called flow.
Create a new Flow from scratch, and name it “Called Flow”. The trigger action should be Request/Response (type “request” in the search box to find it) :
A request action will be added; it expects a JSON definition : copy and paste the following one :
Here again add an action to send an e-mail based on the parameters provided to the workflow :
It is also recommended to send an ok message (http 200) back: so after the Send an email action add a Response action
The flow looks like this :
Save your Flow.
If you edit the flow again and click on the Request action, you will see the generated url in Azure : this is the endpoint to any caller (like the Calling Workflow) will have to target.Copy the url in your clipboard.
We need to test the flow and the Postman application is your friend ; install the (free) Postman Chrome app .
In Postman, create a new collection :
in my case I will name it FlowCallFlow:
Create a request in this collection (we will reuse it in the next blog post) :
Change the verb Get to POST, set the Body to raw and add the following body :
“emailSubject”: “Test Flow call Flow”,
“emailBody”: “Hello from Postman”
Also set the Header to the value key Content-type application/json :
When you click on the Send button, you should get the 200 status code :
This obviously means that the Called workflow has successfully been invoked.Check the sent e-mail.
In Postman save your request in the collection FlowCallFlow.
How can the calling workflow invoke to called workflow ?
The first solution is to use the HTTP action. I will illustrate the second option in my next blog post (Drum Roll suspense 🙂 )
set its properties as following:
You can also remove the Send an email action, we don’t need it anymore.
Save your workflow and and a new item in the SharePoint list.
The called workflow will be invoked, will get the values and will send them via e-mail :
You can off course check the Called workflow history, including the associated values.
In the next post I will show you how to proceed differently.