Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Power Automate Help

(2) ShareShare
ReportReport
Posted on by 4
Hello,

I am having an issue with Power Automate. When an opportunity in D365 is closed as won, I want a Project record to automatically be created, Project is a custom entity. The flow runs successfully, however when I check the raw outputs for the run history all the components seem to capture that the opportunity has been won, I have verified this as I see statuscode = 3 (being the Status Reason field in D365). I have also tried using statecode (Status) where 1 is the equivalent of WON.

However, the final Condition component is constantly being skipped, the data output gives a false result "expressionResult": false. Every component before the condition including the trigger captures the statuscode as 3 so the flow is working as it should do. I have tried many different expressions to get the condition to work, I have even tried converting the status code to a string just in case this was causing the issue using the formula string(triggerOutputs()?['body/statuscode']) followed by: is equal to, followed by ‘3’.

Can anybody help with the formula to get the statuscode to be recognised in the Condition. FYI, I have included the Compose component before the Condition and it is as expected, the data output for it is 3, so this indicates that the trigger is working correctly.

Thank you
  • Suggested answer
    Holly Huffman Profile Picture
    3,754 on at
    Power Automate Help
    Hi there! Good morning, evening, or afternoon - depending on where you are :) Hope you are well today! 
     
    It sounds like you're really close! Based on details you provided, might be HOW the condition is evaluating statuscode. 
    Even though your Compose component confirms statuscode = 3, the condition might not be recognizing it properly due to data type mismatches. When you use the formula (triggerOutputs()?['body/statuscode']) to convert it to a string, make sure you're also comparing it to the correct string representation.
     
    For instance: 
     
    • Simplify the Condition Expression: Update the expression in the Condition component to:
      • equals(string(triggerOutputs()?['body/statuscode']), '3')
    • Ensure Case Consistency: Power Automate is case-sensitive. Double-check that you're using consistent capitalization in your strings
    • Check for Extra Spaces: Ensure that there are no leading or trailing spaces in either your output value or the value you're comparing it to. A quick way to handle this is to use the trim() function:
      • equals(trim(string(triggerOutputs()?['body/statuscode'])), '3')
    • Debugging with Compose: To further debug, add another Compose component after your initial one and use the same string(triggerOutputs()?['body/statuscode']) formula. Confirm that the output matches the expected '3' string
    • Inspect JSON Outputs: Sometimes, the raw JSON data includes unexpected characters. Review the raw outputs of your trigger or Compose components to ensure the statuscode isn't being returned in a format you didn't anticipate (e.g., as part of an array or object)
     
    hope this helps some! 

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!

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,304 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,160 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans