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.

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 @ veenstra.me.uk" }
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.

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:

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

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.

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.