Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Unanswered

If condition for true runs even though it's false

(0) ShareShare
ReportReport
Posted on by 104

I have a basic expression in my flow:

if(not(empty(body('Get_response_details')?['ra7fcccd72d284ee8ae5284e99284ad67'])),json(body('Get_response_details')?['ra7fcccd72d284ee8ae5284e99284ad67'])['displayText'],'N/A')

 

body('Get_response_details')?['ra7fcccd72d284ee8ae5284e99284ad67'] is empty! Nothing in it. When I run 

empty(body('Get_response_details')?['ra7fcccd72d284ee8ae5284e99284ad67'])
it returns true
 
if I check the not of that, it returns false
not(empty(body('Get_response_details')?['ra7fcccd72d284ee8ae5284e99284ad67']))
 
ok, so that's good right? but my if always runs true and errors

 

InvalidTemplate. Unable to process template language expressions in action 'Send_an_email' inputs at line '1' and column '2397': 'The template language expression 'if(not(empty(body('Get_response_details')?['ra7fcccd72d284ee8ae5284e99284ad67'])),json(body('Get_response_details')?['ra7fcccd72d284ee8ae5284e99284ad67'])['displayText'],'N/A')' cannot be evaluated because property 'displayText' cannot be selected. Please see https://aka.ms/logicexpressions for usage details.'.

  • DavidLozzi Profile Picture
    104 on at
    Re: If condition for true runs even though it's false

    New Flow, same problem:

     

    if(greater(length(triggerBody()?['Snippet']),125), substring(triggerBody()?['Snippet'],0,125),triggerBody()?['Snippet'])

    If the snippet is less than 125, it errors on the substring function, even though I tested the greater() statement does return false.

  • DavidLozzi Profile Picture
    104 on at
    Re: If condition for true runs even though it's false
    Sadly that’s what I did... is this an If issue or this datatype?
  • Community Power Platform Member Profile Picture
    on at
    Re: If condition for true runs even though it's false

    this doesn't solve the problem, but a workaround is to make each choice required.  You have an N/A choice, so it shouldn't be a big deal to require it...

  • DavidLozzi Profile Picture
    104 on at
    Re: If condition for true runs even though it's false

    Here's the flow, items highlighted is where I'm trying this expression condition: 

    https://www.screencast.com/t/LLQi02wQ

    Here's the question on the form

    https://www.screencast.com/t/AdK66XKwV

     

    I'm confused by your next question.

     

    And no, not getting the display name, getting the value from a likert. If the value exists, it works, if the value is empty because the user didn't respond, then I get the error.

  • v-xida-msft Profile Picture
    on at
    Re: If condition for true runs even though it's false

    Hi @DavidLozzi,

     

    Could you please share a screenshot of your flow's configuration?

    What does the formula "body('Get_response_details')?['ra7fcccd72d284ee8ae5284e99284ad67']" represent?

    Further, could you please show a bit more about your MS Form?

     

    The error message told that the displayText property could not be selected within the formula "body('Get_response_details')?['ra7fcccd72d284ee8ae5284e99284ad67']" (The Dynamic content representation of a question within your MS Form).

     

    In addition, do you want to get the display name of the question within your MS Form using the "json(body('Get_response_details')?['ra7fcccd72d284ee8ae5284e99284ad67'])['displayText']" formula? If you want to get the display name of a question of your MS Form within Microsoft Flow, I afraid that there is no way to achieve your needs currently in Microsoft Flow.

     

    If you would like this feature to be added in Microsoft Flow, please submit an idea to Flow Ideas Forum:

    https://powerusers.microsoft.com/t5/Flow-Ideas/idb-p/FlowIdeas

     

    We could not use the displayText property to get the display name of a question of your MS Form within Microsoft Flow currently. If I understand incorrectly, please let me know here.

     

    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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,535 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,908 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow