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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

InvalidPluginExecutionException along with HttpErrorCode parameter keeps returning error code 400

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Please consider the below custom workflow piece of code 

class BaseCodeActivity : CodeActivity
{

    protected override void Execute(CodeActivityContext codeActivityContext) 
    {
        throw new InvalidPluginExecutionException("Expected http error code 503", PluginHttpStatusCode.ServiceUnavailable);
    }
}

I've expected to receive a HTTP 503 - Service Unavailable message but I keep getting 400. Not matter which error code I choose, I keep getting the same

Any help greatly is appreciated, Thanks!

I have the same question (0)
  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    Those codes are internal and you can tweak the way it works.

    Can you please explain what's your scenario and why do you need this?

  • Yaniv Bokobza Profile Picture
    Microsoft Employee on at

    Thanks Andrew!

    Could you please provide links or elaborate on how to tweak those error codes

    We have Pcfs using react that calls dynamics process to call the above custom activity. I would like to intercept a returned message based on their http error codes + message and act accordingly. Was wondering whether its a feasible solution or not

    Again, Thanks

  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Sorry for the confusion. I misstyped. What I meant with previous reply is that you can't tweak those code.

    The way I can recommend to use is to send the result back using let's say json with the errorCode/errorMessage/any other information you want to send back.

  • Yaniv Bokobza Profile Picture
    Microsoft Employee on at

    NP, thanks for clearing that up :)

    So the constructor with the current status codes object (PluginHttpStatusCode) is actually a bug as its not really work. Right?

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    To be honest I have never used the InvalidPluginExecutionException this way so I can't answer is it a bug or not.

  • Yaniv Bokobza Profile Picture
    Microsoft Employee on at

    Cool

    Andrew, Thanks a lot for all this info!

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    If my reply (or replies) answers your question take a minute and verify the answer. You can do it by clicking "Yes" at the top of the reply (or replies) under the label "Does this answer your question?"

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 Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Pallavi Phade Profile Picture

Pallavi Phade 102 Super User 2026 Season 1

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 55 Super User 2026 Season 1

#3
ManoVerse Profile Picture

ManoVerse 51 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans