Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

InvalidPluginExecutionException along with HttpErrorCode parameter keeps returning error code 400

Posted on by

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!

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: InvalidPluginExecutionException along with HttpErrorCode parameter keeps returning error code 400

    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?"

  • RE: InvalidPluginExecutionException along with HttpErrorCode parameter keeps returning error code 400

    Cool

    Andrew, Thanks a lot for all this info!

  • a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: InvalidPluginExecutionException along with HttpErrorCode parameter keeps returning error code 400

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

  • RE: InvalidPluginExecutionException along with HttpErrorCode parameter keeps returning error code 400

    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?

  • Verified answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: InvalidPluginExecutionException along with HttpErrorCode parameter keeps returning error code 400

    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.

  • RE: InvalidPluginExecutionException along with HttpErrorCode parameter keeps returning error code 400

    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

  • a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: InvalidPluginExecutionException along with HttpErrorCode parameter keeps returning error code 400

    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?

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans