Hello All Expert,
How to use InvalidPluginExecutionException and where the error message will get logged and where the exception will be shown?
*This post is locked for comments
Hi,
We can throw an exception and display a message.
throw new InvalidPluginExecutionException("Message here....");
This class is used to show a user friendly custom error message. If you want to show a custom message to the user, you can use this class as it will show your message only with the heading as Business Process Error.
Hi
InvalidPluginExecutionException is a class derived from Exception class. So, you can use in the same way as you throw any exception.
This represents an exception that occurred during plug-in execution. When thrown by a plug-in, the Microsoft Dynamics 365 platform displays the exception message in a dialog (as Business Process Error) of the Web application.
You can also use InvalidPluginExecutionException for debugging purpose during development. For example, to find out the Guid of a record you can throw that value as a message in the exception. Plugin stops running and you would get the error message with the Guid value.
Example:
throw new InvalidPluginExecutionException("The name already exists");
There are many constructors available, please refer the following:
[View:https://msdn.microsoft.com/en-us/library/microsoft.xrm.sdk.invalidpluginexecutionexception.aspx:750:50]
Hi you can check following link for handling exceptions in plugin
msdn.microsoft.com/.../gg334685.aspx
Mark answer as verified, if it works for you
Catch the exception and it will give you an option to download the error log in Business Process Error Dialog Box.
Hi,
You could use InvalidPluginExecutionException as follows.
catch(Exception ex) { throw new InvalidPluginExecutionException("Your message"); }
This message will be displayed as a Business Process Error pop-up window.
Hope this helps.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156