We explore the data compliance, security and governance capabilities offered in Microsoft Purview.
Dynamics CRM developers can sometimes find it difficult to debug plug-ins for CRM Online since they don't have the luxury to debug them the same way they do it while writing plug-ins for CRM On-premises. Luckily, a new feature called Plug-in Trace Log was included with Dynamics CRM 2016, and in today's blog, we'll be showing you how you can debug your plug-ins using this new feature.
The Plug-in Trace Log feature saves trace log information, similar to the information you get when an asynchronous plug-in throws an exception, with the advantage that trace log information will be available even when the plug-in doesn't throw an exception. The steps needed to use this feature are broken down below.
1. Write the Plug-in
First, let's write a simple plug-in to test the new Plug-in Trace Log feature. Notice that in the sample code below, we added an instance of ITracingService to log information about the execution of the plug-in as well as logging some key values:
2. Register the Plug-in
For this exercise, we will register this plug-in as follows:
3. Enable Plug-in Trace Log
To enable the Plug-in Trace Log, first navigate to Mail > Settings > Administration.
Once you're in the Administration section, click on System Settings.
From here you can navigate to the Customization tab and select All for the Enable logging to plug-in trace log field. Then click OK.
Test the Plug-in Trace Log
To test the Plug-in Trace Log, open any Account record, update the Fax Number and click on Save.
To check the Plug-in Trace Log entries, click on Main > Settings > Plug-in Trace Log.
Double click on the entry created right after you updated the Account record. Keep in mind that the Trace Log record is created asynchronously, it might take a few seconds for the entry to show in the view.
Once the Trace Log record opens you can investigate the information captured. This page will provides valuable information such as Type Name, Message Type, Primary Entity, Depth, Mode, etc.
Scroll down and check the Message Block under the Execution tab. This is where you will find the trace log information you configured in your plug-in.
IMPORTANT: only enable the Plug-in Trace Log feature if you are debugging or tweaking a plug-in. You don't want to create thousands of trace log records if you are not debugging a plug-in.
That's all for the blog today! You can learn more about the features included in Dynamics CRM 2016 by subscribing to our blog as well as viewing our numerous Webinars on Demand. The CRM Book has been updated to include content for Dynamics CRM 2016 as well, so make sure you check it out!