MS CRM 2015 update 1 plug-in Trace log


         Usually if user writes a plug in , it's difficult to him to check the error log. Finally Microsoft has released new concept to know what is happening in the plug in MS CRM 2015 update 1 release.

How to do it:


  1. Log in to CRM instance.
  2. Go to Settings => System Setting =>Under Customization Tab => Select All or Exceptions.     
  • Off (default): feature turned off
  • Exceptions: the trace logs will be written to the CRM entities only if the developer returns the exception back to the user.
  • All: the trace logs will be written to the CRM entities whenever the plugin/workflow code is run, regardless of whether an exception is returned.
  •      
NOTE: Trace logs will only be written to the trace log entities if the plug-in developer uses tracing within the plug-in.

Write a plug in and along with Tracing object as below.

tracingService.Trace("setPrefixtoAccount(): Creating the Account record with prefix xyz_ started.");

if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
            {

                // Obtain the target entity from the input parmameters.
                Entity entity = (Entity)context.InputParameters["Target"];
                entity.Attributes["name"] = "xyz_" + entity.Attributes["name"].ToString();
            }
            tracingService.Trace("setPrefixtoAccount(): Creating the Account record with prefix xyz_ completed");


      Now Register the plug in as below.



Now go to CRM
   Settings => Plug in Trace Log as below.



















Comments

Popular posts from this blog

Connecting Dynamics 365 Web api using external HTML page

Get azure blob files inside Sub Directories

Interview questions on MS CRM