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 / Has Attachments - Cond...
Power Automate
Unanswered

Has Attachments - Condition if Have

(0) ShareShare
ReportReport
Posted on by 210

For the following flow:

Trigger: When new email is received
If it has attachments then:
Do flow process 1 if not then Do flow process 2

What is the code I need to put for condition of "Has Attachments" is equal to.......what? I tried True, Yes but it didn't work. 

Categories:
I have the same question (0)
  • v-yamao-msft Profile Picture
    on at

    Hi Pladavm,

     

    Please try to configure the condition as following.

     

    In edit mode, select Has Attachment from the Dynamic content, then click the Edit in advanced mode and configure the function with @equals(triggerBody()?['HasAttachment'], bool('True')).

    3.PNG

    4.PNG

     

    I have tested it on my side and it is working as expected. Please try it and let me know if it works for you.

     

    Best regards,
    Mabel Mao

  • RHCC Profile Picture
    40 on at

    You can no longer do this as the "Advanced Mode" feature has been deprecated. Could you please advise how this particular use case can be done using the dynamic expression builder, and without advanced mode? I also need to validate if there are attachments using a condition. Thank you! 

  • Community Power Platform Member Profile Picture
    on at

    I have done it this way and it worked absoutley fine without the complex of formulas. 

     

    Capture.PNG

  • CoachOffice365 Profile Picture
    63 on at

    So it's a matter of using "true" instead of "True" then. 👍😊

  • BFitz Profile Picture
    6 on at

    This is the solution, add  bool('True') to the expression and then back in basic mode it will look like this:

     

    BFitz_0-1652286111396.png

     

  • Alex-W Profile Picture
    315 on at

    @BFitz Thank you for posting the solution!!  

  • wad11656 Profile Picture
    9 on at

    Nnnope. 

    Has Attachment | is equal to | bool('True') 

    (with bool('True') set as an Expression) doesn't work either (at least not for me); defaults to a False result regardless of whether there are attachments are not.

     

    According to the thread we're in--and this one--it's still a mystery as to how to get Has Attachment to work (or at least by using the excact values it's looking for). So might as well consider Has Attachment broken. (Or, at best, unreliable...because it reportedly only works for certain people, and only when used in unorthodox ways.)

     

    From what I can tell, this is the only reliable way to check for attachments:

    length(AttachmentsVariable) | is greater than | 0

    (Annoyingly, as you're typing out this expression, you can't click Attachments from the Dynamic Content list to autopopulate the Attachments "expression" value into your expression. But you can instead just manually type the Attachments "expression" value; one of many weird bugs when trying to create expressions--the primary bug being it telling you the expression is invalid the first time you click "OK", then it works when you click it a second time.)

     

    In my case the formula is:

    length(triggerOutputs()?['body/attachments']) | is greater than | 0

    wad11656_0-1669857218215.png

    This is all kind of silly, because checking if  length(AttachmentsVariable) is greater than 0 is exactly what I would have checked for in the first place, if I hadn't spotted the Has Attachment variable that I wasted way too much of my life wrestling with

  • Alex-W Profile Picture
    315 on at

    @wad11656 it is working for me.  I just did another test and it works.

     

    Has Attachment bool.pngHas Attachment Test.png

  • AaronKnox Profile Picture
    514 Super User 2024 Season 1 on at

    This is working for me as a trigger condition:

    @equals(triggerBody()?['{HasAttachments}'],bool('True'))

     

     

  • krisztina Profile Picture
    13 on at

    Hi everyone,

     

    I know it's an old thread but I had success and thought I would share. I belong to that group of people for whom this does not work as expected. I tried equal"true", "True", "bool(True)", no joy. 

     

    Then, I tried this from another thread and this worked finally! HasAttachment is not equal to null (null as an expression!)

    krisztina_0-1684157269419.png

    I hope this helps!

     

    K.

     

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