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 / Power Automate - condi...
Power Automate
Suggested Answer

Power Automate - condition to send emails with or without attachments

(2) ShareShare
ReportReport
Posted on by 6

I've created a flow on power Automate to send emails based that we fill in one forms that I've created, one of the options is that we have is to send attachments. On this flow, we have a condition that is supposed to analyze if one or more than one file was attached or not.

 

My issue is on this part, so far, I can create this condition. I've tried empty(body('Get_response_details')?['UploadField']) is equal than "true" but is not working, I've also selected the attachment option to compare, but although is not working too. In both the sent e-mail but without follow the condition and don't bring the attachment. Someone knows hot I need to configure.


Follow below the images that how is my flow. I've removed the e-mail just to send these pictures.
 

amaral_diego_0-1744654005571.pngamaral_diego_1-1744654034227.pngamaral_diego_2-1744654069952.png

amaral_diego_3-1744654095278.png

Categories:
I have the same question (0)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,433 Super User 2025 Season 2 on at
     
    If you want to know if a field had something in it (a file for instance)
     
    By default its not going to be empty, and empty and null aren't the same thing.
     
    So you should check for empty and null
     
    or you can check the length(json(property)) as it creates an array. of the length is 0 there is none
     
    If any of these help you, Please mark as such and maybe a like
     
    Feel free to come back if you have issues
  • DF-14041916-0 Profile Picture
    6 on at
    I've tried these options below
     
    empty(body('Get_response_details')?['UploadField']) is equal to true
    even without sending the form without an attachment, it goes to the If yes condition which is where the attachment is configured and gives an error
     
    empty(body('Get_response_details')?['UploadField']) is equal to null
    even if the form is sent with an attachment, it goes to the If condition and sends the email without the attachment.
     
    length(json(property))
    The expression in invalid

    Is just need to know with option I can add here on the condition to the flow understand that if the form has one file attached he sent to e the condition "If yes" id don't has attachment needs to go to the condition "If no"

  • David_MA Profile Picture
    12,982 Super User 2025 Season 2 on at
    This is what Michael is referring to for your condition:
     
     
    The expression on the left uses length() to determine how many attachments are included. The expression is: 
    length(outputs('Get_response_details')?['body/your-question-that-contains-attachments'])
  • DF-14041916-0 Profile Picture
    6 on at
    I've tried like this image, but, returned this error below
     
    length(outputs('Get_response_details')?['body/your-question-that-contains-attachments'])




  • DF-14041916-0 Profile Picture
    6 on at
    someone knows how to do it?
  • Suggested answer
    rzaneti Profile Picture
    4,249 Super User 2025 Season 2 on at
     
    You can fix your expression to length(coalesce(outputs('Get_response_details')?['body/your-question-that-contains-attachments'], ''))
     
    This expression will retrieve the qty of attachments if any, and handle the null scenario by retrieving a zero instead.
     
    Let me know if it works for you or if you need any additional help!
     
    If this solved your issue, please mark it as Accepted Answer.
    👍 If it helped, feel free to give it a like!

    🌐 Explore more Power Platform content on my Website or on my ▶️ YouTube
    💼 Find me on LinkedIn

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 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard