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 / nested if statements i...
Power Automate
Unanswered

nested if statements in functions

(0) ShareShare
ReportReport
Posted on by 32

I am trying to set a variable with different message values based on the outcomes of actions in a flow. I am using this if statement in a compose action to do so:

if(equals(body('Run_HQ-0001-DHR_Execute_JAron_python_script_PAD_flow')?['Message'], null),
outputs('Capture_Error_Message'),

if(greater(length(body('Run_HQ-0001-DHR_Execute_JAron_python_script_PAD_flow')?['Message']), 0),
body('Run_HQ-0001-DHR_Execute_JAron_python_script_PAD_flow')?['Message'],
outputs('JAron_Flow_Failed_Message')))

 

The flow runs successfully and does not give me an issue with this syntax, however the output is always empty. Assuming each output has a value (which they do in the flow), why would the output still be blank? Is something wrong with the syntax, or would you suggest it involves one of the outputs?

Categories:
I have the same question (0)
  • Verified answer
    ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi @dbgghost 

     

    My guess is the body object does not contain message property. Please try removing all ? from the expression to get the error message:

    if(equals(body('Run_HQ-0001-DHR_Execute_JAron_python_script_PAD_flow')['Message'], null),outputs('Capture_Error_Message'),if(greater(length(body('Run_HQ-0001-DHR_Execute_JAron_python_script_PAD_flow')['Message']), 0),
    body('Run_HQ-0001-DHR_Execute_JAron_python_script_PAD_flow')['Message'],outputs('JAron_Flow_Failed_Message')))

    Another way is to use compose actions for each piece of expressions used in the condition to find the exact error.

     

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

     

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

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard