top of page

Handle exceptions in plug-ins



One thing that any CRM developer has to know is how to show a message to the user in a Plugin, every time it is needed, for that the concept of handling with exceptions in CRM has to be understood. On a Async Custom Workflow Acitvity it can be used sometimes to Resume the Process, if it makes sense. From the SDK, as i often call CRM Bible, i took this text: For synchronous plug-ins, whether registered in the sandbox or not, the Microsoft Dynamics CRM platform handles exceptions passed back from a plug-in by displaying an error message in a dialog of the web application user interface. The exception message for asynchronous registered plug-ins is written to a System Job (AsyncOperation) record which can be viewed in the System Jobs area of the web application. For synchronous plug-ins, you can optionally display a custom error message in the error dialog of the web application by having your plug-in throw an InvalidPluginExecutionException exception with the custom message string as the exception Message property value. If you throw InvalidPluginExecutionException and do not provide a custom message, a generic default message is displayed in the error dialog. It is recommended that plug-ins only pass an InvalidPluginExecutionException back to the platform. If a synchronous plug-in returns an exception other than InvalidPluginExecutionException back to the platform, the error dialog is displayed to the user and the exception message (System.Exception.Message) with stack trace is also written to one of two places. For plug-ins not registered in the sandbox, the information is written to the Application event log on the server that runs the plug-in. The event log can be viewed by using the Event Viewer administrative tool. For plug-ins registered in the sandbox, the exception message and stack trace is written to the Microsoft Dynamics CRM platform trace. For more information about tracing, see the Logging and Tracing section of the Debug a plug-In topic.

16 views0 comments

Recent Posts

See All

Comments


bottom of page