In part 2 of this mini series about organising your flows into functions I will look at calling multiple functions. If you missed part 1 then please have a look at Function Libraries in Microsoft Flow, for the introduction of the function library pattern.

In this post I’m looking at calling multiple function branches in my flow.

The Changes in the sample PowerApp

I’ve made some changes in my PowerApp, so that when the submit button is pressed an additional function call is added to the data sent to my flow.

PowerApps Changes

Note: In my example I’m using  PowerApps to call the functions but of course you could use anything else to pass these to a flow. It doesn’t have to be a PowerApp.

{
   "Function_Inputs": "Plus:23:25;SendEmail:contact @ sharepains.com"
}

In my PowerApp I now want to get an array of function like I used in Function Libraries in Microsoft Flow – Part 1 so that I don’t need to make too many changes to my flow.

Split function

In my example above, I’m first repeating the same function as in my previous post and then I’m sending an email.

The above is done with an action like this:

Split Edit Mode

Now I’ll have a variable called  FunctionsQueue containing all the functions to process.

Processing the function queue

Now i can process the queue with the following steps

Process The Queue

I now simply keep processing the functions until all the functions have been processed. The big difference here is that the filter array and Set variable actions will remove the processed action from the queue before the next function is processed.

Finally I’ve added another function in my switch to send emails.

Send Email

In the above send mail example I’ve only taken the email address form the function parameters but you could of course add more parameters to the email subject or body.

In my next post in this series I will look at adding the try catch pattern to this functions library pattern.


Discover more from SharePains

Subscribe to get the latest posts sent to your email.

Avatar of Pieter Veenstra

Is your business still running on paper trails, sprawling Excel files, or ageing Access databases? There's a better way — and I can show you exactly what it looks like. I'm the Technical Director of Vantage 365, a Microsoft solutions consultancy working with clients across the UK, the Netherlands, and worldwide. For over 30 years I've been turning messy, manual business processes into clean, automated systems that save time, reduce errors, and give teams the visibility they need to make better decisions. SharePains is not just any blog run by a Microsoft MVP. Have you ever used Try-Catch in Power Automate? The original post about Try-Catch in Power Automate can still be found on this site, https://sharepains.com/2018/02/07/try-catch-finally-in-power-automate-flow/ Or have you ever used the Pieter’s method to avoid variables and speed up your flows? https://sharepains.com/2020/03/11/pieters-method-for-advanced-in-flows/ You can contact me using contact@sharepains.com

Related Posts

Leave a Reply

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

Discover more from SharePains

Subscribe now to keep reading and get access to the full archive.

Continue reading