Microsoft Dynamics CRM 2011

Microsoft Dynamics CRM 2011

Tuesday, April 21, 2015

How to use Tracing in CRM 2011-2013 Plugins and Workflows

In this article we describe Step by step How to use Tracing in CRM 2011-2013 Plugins and Workflows in C# in 5 minutes.
Since CRM Plugins and Workflows are deployed on web servers after the development reaches the release stage , it is usually very helpful to include tracing in your code in profusion, not only in error cases, at least when you are putting to the test new developments .
CRM 2011-2013 allows you to include tracing galore:
How to use Tracing in CRM 2011-2013 Plugins and Workflows



How to use Tracing in CRM 2011-2013 Plugins and Workflows



Phase 1: use the GetExtension() method from the "context" at your plugin-workflow:
Tracing in CRM 2011-2013 Plugins and Workflows


Since this is a generic C# Dot.Net method, use the ITracingService interface to get the tracing service from the context.


Phase 2: Send the ITracingService to any method where you intend to log information using tracing:

CRM 2011-2013 Plugins and Workflows

For example:

How to use Tracing in CRM


Phase 3: inside the plugin's methods, call the ITracingService's Trace() method to send messages to the tracing:

How to use Tracing in CRM 2011-2013


In case of error, CRM will display an alert showing the tracing:


How to use Tracing in CRM 2011-2013 Plugins and Workflows


That's all...Enjoy Dynamics CRM

by Carmel Schvartzman

כתב: כרמל שוורצמן


    No comments:

    Post a Comment