cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
b1tz
Helper I
Helper I

Optimizing complex flow

Hi, I have built a flow that get files from a onedrive folder and then sends emails with those files as attachments. Depending on different keywords these files gets sent to different groups of people. I'm only about 25% done because there are hundreds of different combinations of files and each combination requires a unique setup of recipients and CC's.

 

The flow is structured as shown in the picturues:

1. Initialize variables for arrays (attachments)

2. List files

3. Apply to each (Get metadata, Get filecontent, Filter condition to only append specific files, Append to array, Move file to a "Sent"-folder)

4. Send E-mail.

 

Now there are alot of Apply to Each and they are starting to clog down the process. Can take between 30 - 50 mins in total. I tried concurrency setting but setting it to high results in errors. It skips files etc. But setting it on 1 makes it really slow.

 

Are there any ways to do this better? Maybe avoid Apply to each?

 

overview1.png

ate1.png

ate2.png

 

3 REPLIES 3
VictorIvanidze
Community Champion
Community Champion

Have a look at this: https://powerusers.microsoft.com/t5/Using-Flows/Slow-running-of-Apply-to-each-only-joining-data/m-p/...

--------------------------------------------------------------------------------------
Contact me if you are interested in custom Power Automate development.

Does that actually work for file contents? Something like Select and using output from List files in onedrive? My e-mails are hardcoded in Send e-email, the issue is filtering and sorting .pdfs and .jpgs to the correct array and then sending an e-mail with that array.

VictorIvanidze
Community Champion
Community Champion

Radical way to speed it up is using MS GRAPH requests. But it will require a lot of work.

--------------------------------------------------------------------------------------
Contact me if you are interested in custom Power Automate development.

Helpful resources

Announcements
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.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

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.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Top Kudoed Authors
Users online (1,368)