Microsoft Dynamics CRM provides two different configuration fields for plug-ins, namely Secure Configuration and Unsecure Configuration.
Use Secure Configuration, when a setting is sensitive and shouldn’t be readable by any CRM user or if you don’t want that setting to be moved between environments while importing/exporting solutions.
Secure configuration is only viewable by CRM Administrators while the Unsecure Configuration is viewable by any CRM user. Also, unsecure configuration will automatically move between environments with your CRM solutions while it is not the case in secure configuration.
How to Handle Exceptions in Plug-ins?
Handling exceptions means establishing alternate ways to continue the flow of a program.
- The exception message for asynchronous registered plug-ins is written to a System Job.
- 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 with the custom message string as the exception Message property value.
- For asynchronous plugins, no error is prompted to the user.
- If there are any exceptions in plug-ins, the code will execute in database and the plugins will rollback. So, exception handling needs more attention.
- In plug-in code, you need to place below lines of code to catch the exception thrown by plugins.
catch (FaultException ex)
throw new InvalidPluginExecutionException("Err occurred.", ex.Message);
- Plug-in trace log in Dynamics CRM, which made for debugging a plugin.
- The Plug-in trace log feature saves trace log information with the advantage that trace log information will be available even when the plug-in doesn’t throw an exception.
Need help in CRM Plug-in Development? Talk to our CRM experts now. You can write to us at email@example.com.