web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Automate
Answered

Can't make IF work

(0) ShareShare
ReportReport
Posted on by 127

What am I doing wrong?

 

if(length(outputs('Execute_stored_procedure_(V2)_-_Create_projects_in_database')?['body/outputparameters/outputContactFirstName'])=0, triggerBody()?['contactFirstname'], outputs('Execute_stored_procedure_(V2)_-_Create_projects_in_database')?['body/outputparameters/outputContactFirstName'])

 

I keep getting an 'The expression is invalid' error.

Categories:
  • Verified answer
    fchopo Profile Picture
    8,003 Moderator on at

    You should replace "=" by using "equals" function:

    if(equals(length(outputs('Execute_stored_procedure_(V2)_-_Create_projects_in_database')?['body/outputparameters/outputContactFirstName']),0), triggerBody()?['contactFirstname'], outputs('Execute_stored_procedure_(V2)_-_Create_projects_in_database')?['body/outputparameters/outputContactFirstName'])

    Hope it helps!

    Ferran

  • DanielPineault Profile Picture
    127 on at

    No Words, the language doesn't handle simple equalities?!  You need to use a function.  OMG.

     

    At least I learnt something new today.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I think generally speaking the '=' sign assigns values to a variable, it does not compare them. When you need to start compare values, the 'equals' function is more appropriate. 

  • DanielPineault Profile Picture
    127 on at

    length() returns explicit numerical values, does it not?

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 249 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 202

#3
David_MA Profile Picture

David_MA 180 Super User 2026 Season 2

Last 30 days Overall leaderboard