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 Platform Community / Forums / Power Automate / Can somebody tell me w...
Power Automate
Answered

Can somebody tell me why this expression is invalid?? Why is it so hard to code in power automate?

(1) ShareShare
ReportReport
Posted on by 836 Moderator
The expression is. 
 
if(
    empty(triggerOutputs()?['body/ConfidentialInformation_Extract']) && empty(triggerBody()?['ExceptionConfidentialInformation0']), 
    'The definition of confidential information is missing', 
    if(
        !empty(triggerOutputs()?['body/ConfidentialInformation_Extract']) && empty(triggerBody()?['ExceptionConfidentialInformation0']),
        concat('There is a definition of confidential information on page ', triggerOutputs()?['body/ConfidentialInformation_PageNumb'], ' and its exceptions are missing.'),
        if(
            empty(triggerOutputs()?['body/ConfidentialInformation_Extract']) && !empty(triggerBody()?['ExceptionConfidentialInformation0']),
            concat('There is a definition of exception to the confidential information on page ', triggerBody()?['ExceptionConfidentialInformation1'], ' and the confidential information is missing.'),
            concat('There is a definition of confidential information on page ', triggerOutputs()?['body/ConfidentialInformation_PageNumb'], ' and exception to the confidential information on page ', triggerBody()?['ExceptionConfidentialInformation1'])
        )
    )
)

Additionally, has anybody found a way to code better in power automate? Its always like this when I put expression in here plus the tiny little screen makes it harder to code because you can't see it all. I've tried the modern one but its still hard because it seems like there is 2 different systems when you use the old designer and the new designer. Its really frustrating to work with power automate and using expressions. 
 
Categories:
I have the same question (0)
  • Verified answer
    trice602 Profile Picture
    16,239 Super User 2026 Season 1 on at
    Hi,
     
    Please try this update.
     
    if(
        and(
            empty(triggerOutputs()?['body/ConfidentialInformation_Extract']), 
            empty(triggerBody()?['ExceptionConfidentialInformation0'])
        ), 
        'The definition of confidential information is missing', 
        if(
            and(
                not(empty(triggerOutputs()?['body/ConfidentialInformation_Extract'])), 
                empty(triggerBody()?['ExceptionConfidentialInformation0'])
            ),
            concat(
                'There is a definition of confidential information on page ', 
                triggerOutputs()?['body/ConfidentialInformation_PageNumb'], 
                ' and its exceptions are missing.'
            ),
            if(
                and(
                    empty(triggerOutputs()?['body/ConfidentialInformation_Extract']), 
                    not(empty(triggerBody()?['ExceptionConfidentialInformation0']))
                ),
                concat(
                    'There is a definition of exception to the confidential information on page ', 
                    triggerBody()?['ExceptionConfidentialInformation1'], 
                    ' and the confidential information is missing.'
                ),
                concat(
                    'There is a definition of confidential information on page ', 
                    triggerOutputs()?['body/ConfidentialInformation_PageNumb'], 
                    ' and an exception to the confidential information on page ', 
                    triggerBody()?['ExceptionConfidentialInformation1']
                )
            )
        )
    )
    
     
     
    Replaced && with and() (Power Automate does not support &&, it uses and() for multiple conditions).
     
    Replaced !empty() with not(empty()) (Power Automate requires not() for negation).
     
    Ensured ExceptionConfidentialInformation1 is referenced consistently.
     

    ------------------------------------------------

     

     

    ⭐ If this was helpful, please like and mark as a verified answer to help others find this too!

     

     

    Always glad to help! 💯💯💯💯💯

     

    Tom

     

    Follow me on LinkedIn - Thomas Rice, PMP | LinkedIn

     
  • KevinGador Profile Picture
    836 Moderator on at
    Thanks @trice602

    I was using copilot to help me why it was failing and it did not specify that the use of && and ! is not supported for multiple conditions :( 

    thanks for the insights as well! 
  • Chriddle Profile Picture
    8,686 Super User 2026 Season 1 on at
    There isn't such an and operator. You have to use the function and()
  • KevinGador Profile Picture
    836 Moderator on at
    One additional question, in the new designer how do you make the code readable if the Tab button is disabled for indentions? @trice602
  • trice602 Profile Picture
    16,239 Super User 2026 Season 1 on at
    Hi Kevin,
     
    Yeah there's more work to be done there for sure.  What has worked for me is I will take my low-code and paste it into ChatGPT and ask for formatting and review for validity, it does a pretty good job.
     
    "Format and review this code for validity" then paste in your code.  
     
    But noted, we need more than a little box :)
     

    ------------------------------------------------

     

     

    ⭐ If this was helpful, please like and mark as a verified answer to help others find this too!

     

     

    Always glad to help! 💯💯💯💯💯

     

    Tom

     

    Follow me on LinkedIn - Thomas Rice, PMP | LinkedIn

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 796

#2
Valantis Profile Picture

Valantis 671

#3
Haque Profile Picture

Haque 551

Last 30 days Overall leaderboard