Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

Don't send email if the flow body is empty

(1) ShareShare
ReportReport
Posted on by

Hi,

I have created a Flow to call the kusto function and email the kusto object as Bar chat. But I don't want to send an email if the kusto function return null or empyt. How to validate this. I have put the condition expression before sending email and try but didn't work as expected. Please let me know how to validate it. Any help will be appreciated.

 

FlowWithCondition.PNGFlowWithConditionExpression.PNG

  • Biswapati Profile Picture
    on at
    Re: Don't send email if the flow body is empty

    Run the flow and see the output by cliking on the "Search for users" action. Replace the 'Value' with the item that you are getting inside the Body as below (For your reference). I have used  'empty(body('Search_for_users')?['value'])'  and working for me. If it's not working then I am just the beginner of the flow. You can post your question in the group. Someone ight help you.

     

    Example:

     

    Body
    {
      "value": []
    }
     
  • ccollins Profile Picture
    10 on at
    Re: Don't send email if the flow body is empty

    I'm getting the following error: 

     

    InvalidTemplate. Unable to process template language expressions for action 'Does_user_exist' at line '1' and column '2223': 'The template language expression 'empty(body('Search_for_users')?['value'])' cannot be evaluated because property 'value' cannot be selected. Array elements can only be selected using an integer index. Please see https://aka.ms/logicexpressions for usage details.'.

  • Biswapati Profile Picture
    on at
    Re: Don't send email if the flow body is empty

    Yes, Below expression work for me :

     

    @empty(body('Run_query_and_list_results')?['value'])

  • ccollins Profile Picture
    10 on at
    Re: Don't send email if the flow body is empty

    Did you ever find a solution to this? I'm having the same problem.

  • Biswapati Profile Picture
    on at
    Re: Don't send email if the flow body is empty

    Can anyone help me to resolve this issue. This issue is still open.

  • Biswapati Profile Picture
    on at
    Re: Don't send email if the flow body is empty

    Can anyone please help me on resolve this issue. Even I can change to Html table instead of Bar chart. Please let me know the solution for both Html Table & bar chart.

  • Biswapati Profile Picture
    on at
    Re: Don't send email if the flow body is empty

    Thanks for reply,

    The connector is "Kusto - Run query and visualize results ". I have tried the expression @empty(body('Run_query_and_visualize_results')). But it's always return false whether the "Kusto - Run query and visualize results" return data or not. I have tried follwoing option that didn't work for me :

    @contains(body('Run_query_and_visualize_results')?['body'], 'com.microsoft')
    empty(item()?['appId'])
    @and(empty(item()?['appId']), empty(item()?['standardDeviationRate']))
    @and(empty(item()?['appId']), empty(item()?['standardDeviationRate']))
    @empty(body('Run_query_and_visualize_results')?['body'])
    @equals(body('Run_query_and_visualize_results')?['body'], '')
    @equals(body('Run_query_and_visualize_results'), '')
    @contains(body('Run_query_and_visualize_results'), 'com.microsoft')
    @empty(body('Run_query_and_visualize_results'))
    @not(empty(body('Run_query_and_visualize_results')['body']))
    @contains(coalesce(body('Run_query_and_visualize_results')['body'], ''), 'com.microsoft')
    @empty(coalesce(body('Run_query_and_visualize_results')['body'], ''))
    Error-:
    InvalidTemplate. Unable to process template language expressions for action 'Condition' at line '1' and column '2168': 'The template language expression 'not(empty(body('Run_query_and_visualize_results')['appId']))' cannot be evaluated because property 'appId' doesn't exist, available properties are 'attachmentName, attachmentContent, body'. Please see https://aka.ms/logicexpressions for usage details.'.
     
    @not(empty(body('Run_query_and_visualize_results')['body']['appId']))
    Error-:
    InvalidTemplate. Unable to process template language expressions for action 'Condition' at line '1' and column '2168': 'The template language expression 'not(empty(body('Run_query_and_visualize_results')['body']['appId']))' cannot be evaluated because property 'appId' cannot be selected. Property selection is not supported on values of type 'String'. Please see https://aka.ms/logicexpressions for usage details.'.
     
    Thanks
    Biswapati
  • v-xida-msft Profile Picture
    on at
    Re: Don't send email if the flow body is empty

    Hi @Biswapati,

     

    Which connector do you use in your “Run query and visual results” action?

    I don’t find the connector on my Microsoft Flow, so I could not make a test on my side.

    According to the screenshot that you provided, please take a try to type the following formula in Condition box:

    @empty(body('Run_query_and_visualize_results'))

    20.JPG

     

    Best regards,

    Kris

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 566 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 516 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 492