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

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Error message dialog does not show up when throwing InvalidPluginExecutionException

(0) ShareShare
ReportReport
Posted on by

In Opportunity screen, I have an subgrid of OpportunityProduct can be added. I have a PreCreate OpportunityProduct plugin which checks for some conditions to show error message and stop creating.

So in this plugin I added:

throw new InvalidPluginExecutionException("My message");

But no dialog message is shown up but an error notification on top of the subgrid with message: "ISV code aborted the operation".

Please tell me why is my message not displayed? And how to solve this?

Thank you verymuch.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    nghieppham Profile Picture
    4,755 on at
    RE: Error message dialog does not show up when throwing InvalidPluginExecutionException

    Hi Tvn,

    For product module, when you add product, there are some system plugin will be run to calculate many things. Due to your plugin has error, these plugins will be rollback and show this error, in this case, you should debug your plug-in to trace the problem first.

    Regards,

  • Community Member Profile Picture
    on at
    RE: Error message dialog does not show up when throwing InvalidPluginExecutionException

    Thanks Nghiep for the answer (Cảm ơn bạn Nghiệp ;) ).

    I have a business to show an error message and stop the plugin execution, that's why I throw an InvalidPluginExecutionException in the code.

    What I expect is the message "My message" is displayed in opportunity for, or even it is displayed in the error notification on top of the subgrid, instead of the "ISV code aborted the operation"

  • Suggested answer
    nghieppham Profile Picture
    4,755 on at
    RE: Error message dialog does not show up when throwing InvalidPluginExecutionException

    Hi Tvn,

    In this case, you should combine between javascript and managed code. Because there are system plug-in will be run at the same time of OpportunityProduct  to calculate tax, prices..., hence it will be roll back all operation of system.

    Hence, you can use C# (plugin) or operation and throw message and use javascript in CRM form to capture the error (you can use Try catch of javascript), then use Xrm Nofification of Xrm.Page to show message in the top form or your control.

    Hope that it will be clear for you.

    Regards,

  • Community Member Profile Picture
    on at
    RE: Error message dialog does not show up when throwing InvalidPluginExecutionException

    Hi Nghiep,

    Please guide me how to use javascript in CRM form to capture the plugin error ?

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

#3
ED-30091530-0 Profile Picture

ED-30091530-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans