web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Adding attachment to a...
Power Automate
Unanswered

Adding attachment to approval - Creates "Apply to each"

(0) ShareShare
ReportReport
Posted on by 13

When creating an approval, I wish to attach and attachment which was originally sent via email. Whenever I attempt this, it creates an "apply to each", which I suspect is due to the fact that there could be multiple attachments. There will only ever be one attachment based on the flow I have created. How can I prevent an "Apply to each".

Many thanks

Categories:
I have the same question (0)
  • fchopo Profile Picture
    8,003 Moderator on at

    Hi @HC123 

    In order to avoid the apply to each, you should get the first attachment within the email using the following expression:

    first(triggerOutputs()?['body/attachments'])

    assuming you're using the trigger "when a new email arrives".

    For instance, if you want to access the attachment name you should write the expression:

    first(triggerOutputs()?['body/attachments'])?['name']

    And the same for other properties.

    Hope that helps!

    Ferran

     

  • HC123 Profile Picture
    13 on at

    Thanks for the detailed information. Could you please clarify where this expression should go? Is it being set in a variable, or elsewhere?

     

    Thanks again.

  • fchopo Profile Picture
    8,003 Moderator on at

    Hi @HC123 

    You could use this expression in a Compose action, for instance. Use the output of the compose action in next steps when you need to access attachment content or attachment name.

    Hope it helps now!

    Ferran

  • HC123 Profile Picture
    13 on at

    Thank you for your help.

    I am running in to issues with the document when attached to an approval. I've tried the below to try and get the content of the file 

    first(triggerOutputs()?['body/attachments'])

    However, the file attaches visually, and the name is shown correctly, but the file won't open or display, regardless of the file type tested.

    I've also tried swapping the below 'name' swapped for 'attachment_content', and it returns this error.

    HC123_0-1673606160423.png
    Any advise would be greatly appreciated.

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard