Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Can't make IF work

(0) ShareShare
ReportReport
Posted on by 113

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.

  • DanielPineault Profile Picture
    113 on at
    Re: Can't make IF work

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

  • Community Power Platform Member Profile Picture
    on at
    Re: Can't make IF work

    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
    113 on at
    Re: Can't make IF work

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

     

    At least I learnt something new today.

  • Verified answer
    fchopo Profile Picture
    7,968 Super User 2025 Season 1 on at
    Re: Can't make IF work

    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

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