In Part1 and Part2 we looked at the various aspects of plug-in as applicable to Dynamics CRM platform. In this section I will be building a simple plug-in using the CRM 2013 SDK and look at the support SDK / VS 2012 provides in terms of debugging, deployment etc.
Scenario: The Plug-in aims to create a Task whenever a record is created in Account entity.
Two assemblies are important and need to be referenced in the plug-in assembly project viz., Microsoft.Crm.Sdk.Proxy.dll and Microsoft.Xrm.Sdk.dll and they provide the interfaces required to extract information from the CRM system.
As I have used templates available for CRM 2013 solution much of the boiler plate code is already created by the template and is in Plugin.cs. The Additional class that we create will be done via Create Plug-in dialogue as explained in Part2. The custom code will be written in Execute[ClassName] method, in this example it will be ExecutePostAccountCreate method.
The two important interfaces used are:
IPluginExecutionContext: Provides the contextual information passed to a plug-in at run-time. The information contained describes the run-time environment that the plug-in is executing in, information related to the execution pipeline, and entity business information.
IOrganizationService: Provides access to metadata and data for an organization.
CRM 2013 SDK has very good documentation on all the available interfaces, methods etc.
Once the plug-in is deployed as per steps in Part2 I would normally expect that when I create a record in the Account entity a Task activity is created, but I get the following which is handy in a way as I can explore what I need to be looking at to get it fixed:
Problem Occured How to Trobule Shoot and Fix the Issue:
Given our relatively smooth and unsuccessful journey into plug-in development so far, we will now look at options to debug the code written and the support CRM 2013 SDK provides in this context.