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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

adding payload to code activity exception

(0) ShareShare
ReportReport
Posted on by

i'm writing a PCF that calls a code activity.

in the ode activity i want to throw exceptions of 2-3 types and i want to differentiate between them with a simple condition

is it possible to add errorType, or any other field to the exceptions returned from the code activity? is there any documentation on this?

thank you

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

    Hello,

    I usually use the following approach:

    1. In the action or custom api (I believe this is what you are talking about) I introduce new properties like "Success (bool)", "ErrorMessage (string)".

    2. When something goes wrong in the codebehind I just set Success to false and pass ErrorMessage that contains the description of what exactly wrong.

    3. Use Success/ErrorMessage in clientside code.

  • liranelisha Profile Picture
    on at

    hmmm... that means all the calls to the backend return 200, even though some of them are failures, right?

    is this the best practice in dynamics?

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

    The challenge here is that you don't have control over the code that is returned and you can set the message returned only.

    That is why I used this approach to differentiate between different issues that could occur at the backend.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 72 Super User 2025 Season 2

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 29 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans