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 / Error Trying to Close ...
Power Automate
Answered

Error Trying to Close D365 CRM Opportunity Using Power Automate

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I'm trying to use Power Automate to close D365 CRM opportunities that meet a specific condition, but when I get to the step that closes the opportunity, I get an error - 0x80040216 - An unexpected error has occurred. Status Code 400. I'm using the Microsoft Dataverse Connector - Update a Row with a table name of Opportunity Close Activities. Below is a screen shot of the step that is failing. Does anyone have any idea what my problem may be? I've researched and tried different things until I'm blue in the face. I would appreciate any help. Thanks.

 

ScottAGrimes_0-1620415199642.png

 

 

Categories:
I have the same question (0)
  • ChrisPiasecki Profile Picture
    6,422 Most Valuable Professional on at

    Hi @Anonymous,

     

    You can leverage the out of box WinOpportunity unbound action in Dynamics 365. The Dataverse connector has a Perform an Unbound Action step you can add and pick from a list of available actions in the environment.

     

    Note there is some known complexities/challenges when working with actions that have an entity reference parameter type. This requires you to manually set the Json object, in this case is the related Opportunity that you want to close. Hopefully MS addresses this in the near future to make bound/unbound actions easier to work with in the Power Automate designer. 

     

    This blog post describes this complexity in depth and provides examples of how to run some of the actions (I asked the author to provide one for WinOpportunity specifically earlier, so you should be able to get yours working).

     

    ---
    Please click Accept as Solution if my post answered your question. This will help others find solutions to similar questions. If you like my post and/or find it helpful, please consider giving it a Thumbs Up.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you Chris for your help!

  • ChrisPiasecki Profile Picture
    6,422 Most Valuable Professional on at

    Hi @Anonymous,

     

    Did that end up working for you? If so, please mark the reply as a solution so that others with a similar problem in the future can find this easier. 

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Actually, I got a suggestion in the CRM User's Group that I used before I saw your reply. Instead of using the Microsoft Dataverse - Update A Row with the table Opportunity Close Activities, I was advised to use the Microsoft Dataverse - Add A New Row with the table Opportunity Close Activities. It seems counterintuitive that you would add a row when trying to close the opportunity, but that worked perfectly. One word of caution for anyone using this solution, when identifying the opportunity to close, be sure to use the Odata Id, not just the opportunity id.

  • ChrisPiasecki Profile Picture
    6,422 Most Valuable Professional on at

    Hi @Anonymous,

     

    Note that the WinOpportunity action does those things you mention behind the scenes and replicates the same behaviour as clicking the close as Won button on the user interface. There is an equivalent action for LoseOpportunity as well. I would recommend using the out of box actions whenever possible as it has the least chance for unexpected side behavior to occur.

     

    ---
    Please click Accept as Solution if my post answered your question. This will help others find solutions to similar questions. If you like my post and/or find it helpful, please consider giving it a Thumbs Up.

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!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 124 Super User 2026 Season 1

#2
Ellis Karim Profile Picture

Ellis Karim 52 Super User 2026 Season 1

#3
Haque Profile Picture

Haque 50

Last 30 days Overall leaderboard