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

Flow Attaching Duplicates of Attachments to Email - When Only Supposed to Attach 2 Attachments

Hi,

 

I am running a flow which attaches multiple attachments to an email, 2 attachments in this case from a folder in One Drive. The issue I am having is that the flow is duplicating the attachments and attaching around 40 - 60 attachments when there is only supposed to be 2 attachments.

 

See my flow below.

 

Any suggestions to resolve this?

 

Regards,

Mike

 

1.png

 

2.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User II
Super User II

The issue is likely your nested for each loops. I'd recommend adding the conditions outside of the loop. 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

6 REPLIES 6
Super User II
Super User II

The issue is likely your nested for each loops. I'd recommend adding the conditions outside of the loop. 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Hi @Brad_Groux 

 

Thanks for the reply.

 

Unfortunately when doing a flow like this pulling the files from OneDrive the flow does not work unless the loops are nested. For example when drawing files from SharePoint what you have suggested will work but not for OneDrive.

 

Any other suggestions to try?

Community Support
Community Support

Hi @Mike1005,

 

Please add a Compose action with length() function to check the array length before Send an Email action. If the length of the array is 40-60, but the email just contains 2 attachments, it is some error with send email action, or it is the issue of your Flow structure.

Annotation 2020-01-14 153450.png

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-litu-msft 

 

Thanks for the reply.

 

Unfortunately the recommendation also does not work. I have also tried as many different combinations in my flow trying to incorporate this with no luck.

 

Regards

Mike

Hi @Mike1005,

 

So, what's the result of the length of the attachment array?

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-litu-msft 

 

The following message:

 

"The inputs of workflow run action 'Compose' of type 'Compose' are not valid. The variable 'Attachments' must be initialized before it can be used inside action 'Compose'."

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Top Kudoed Authors
Users online (7,208)