Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum
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,321 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,321 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,321 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,321 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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

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

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,532 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,501 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans