Showing results for 
Search instead for 
Did you mean: 
Advocate I
Advocate I

Run One Large Flow or Multiple Flows

I'm hoping for some advice/comments/concerns from some folks more knowledgeable with the Power Platform than myself regarding a scenario I'm facing.  I'm trying to transition an older dotnet application to the Power Platform and am running up against a stumbling block.


I am building a canvas app that lets users create a file package.  A file package consists of multiple files selected by the user.  Let's use a homeowners insurance policy as an example of a file package.  A HO policy will consist of a main policy file but can also include several additional files depending on if the homeowner selects additional coverage.  For example, not all HOs will add excess liability coverage but some will, or some HOs have expensive personal property (e.g., jewelry) they want extra coverage for.  These cases will produce file packages with a different set of files: one main file and any combination of additional files depending on the home owner's coverage selections.


I would like to create a canvas app that creates the file package after a user makes their selections.  A user selects which files to include and Power Automate creates the individual documents based on templates.  The templates are populated with data entered in the app.  In our HO Policy example, if a user adds extra coverage for personal property, they will select that template to add to the file package (file package now includes: main policy file and personal property file).  That selected template will be populated with data captured in the app regarding the items and values of the personal property.  


How do I implement this via a Power Automate flow triggered from my Canvas App? 


I thought about creating one large flow:  A user makes the selections and when finished clicks a button and the canvas app sends an array of selected templates to the flow.  However, I don't see how this would work because the Populate MS Word Template step needs to know the specific template when creating the flow in order to map data to the template fields.  If the template isn't defined until a user selects which ones they would like to add, the flow has no idea which template to use in the Populate MS Word Template step.  I also don't see how to dynamically run a set of child flows based on an array of template names sent to the parent flow.  For example, create individual flows for each template then have the array of selected templates define which child flows to run from a master parent flow.  So, unless I'm missing something, this doesn't seem like the correct approach.


Another option: create a button (toggle, icon, etc) for each available template in the canvas app.  When a user wishes to add that template to the file package they make the selection.  OnSelect triggers an individual flow for each selection.  This approach has promise but will require building a flow and corresponding button for each template.  Not a huge deal but cumbersome.  This appears to be the correct approach.


Anyway, thanks for reading.  Any input/comments/concerns would be greatly appreciated.  Thanks in advance.



Power Participant
Power Participant

@djallen I would create a collection in your app with 2 columns: 

  1. File Name
  2. Selection (true or false)

Have a gallery which displays the items in that collection and have a checkbox/toggle to represent the 'selection' column.

When a user checks or unchecks any item in the gallery, update the collection in the app using 'patch'.

Have a submit button which will send the whole collection as an array to a flow. Create a flow with an apply to each on the array then a switch case for each file type/name and lastly a condition to see if each file should be included or not and then have the specific template for each file under each 'yes' result from the condition. Save all the files in a specific folder.


Hope that helps






Thanks for the suggestion.  Seems like a plausible solution although I'd be looking at 80 - 100 switch cases.  I read there's a 25 case limit for switch cases.  Would you suggest running 5 x 25 case switch cases sequentially on the array?  I wonder if it wouldn't be faster to just run a flow for each time a user selects a file.  So, have a selection button for each file.  User clicks the button and it runs the flow for that file.  If a user only selects 5 files, only five flows run vs running through 100 switch cases in one large flow.


Thanks for letting me bounce some ideas off you.





Power Participant
Power Participant

@djallen In a regular case if you have a large number of cases then the best option would be to store them in a list/table somewhere and then lookup the values in that table instead of using a switch case.

The problem in your case is if each output is a different file then this approach would not work as the 'word template' connector doesn't work with dynamic file names. If this is indeed your setup then the only suggestion would be to group/categorise your files and then use a sub-flow per category. So when your user selects a file in the app, the category of that file would also be saved in the collection and sent on to the flow. Then according to the category, you can call a specific sub flow and within that sub flow you would only have cases for the files in that category.

In the same sense you could just use a master switch case for category and then sub cases for file. I just feel that setup becomes messy and hard to manage in one giant flow hence the sub flow suggestion.

@SamPo You've hit the nail on the head.  The templates are all different and any combination of the templates must be supported.

Helpful resources

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,077)