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,313 Super User 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,313 Super User 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,313 Super User 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,313 Super User 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?

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,768 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,985 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans