Sunday, October 31, 2010

Changes in CRM 2011 plugins

There are a lot of syntax and functional changes in MSCRM 2011 plugins. I have listed some of them below:
1. New References
• System.ServiceModel
• System.Runtime.Serialization

2. Microsoft.Crm.Sdk has been replaced by Microsoft.Xrm.Sdk

3. The default parameter for execute method has been changed from
IPluginExecutionContext to IServiceProvide


public void Execute(IServiceProvider serviceProvider)

4. IpluginExecutionContext has been changed to a type of service and to get the reference use the following syntax.

IPluginExecutionContext context = (IPluginExecutionContext)
serviceProvider.GetService(typeof(IPluginExecutionContext));

5. ICrmService has been changed to IOrganizationService

IOrganizationServiceFactory serviceFactory =
IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);

6. Dynamic entity has been changed to “Entity”

if (context.InputParameters.Contains("Target") &&
context.InputParameters["Target"] is Entity)
{
Entity entity = (Entity)context.InputParameters["Target"];
}


7. Dynamic Entity’s properties syntax has been changed to attributes

entity.Attributes.Contains("accountnumber")

8. Strongly typed classes (account, contact) are missing in Microsoft.XRM.Sdk assembly but there is an exception to this.

9. CRM 2011 provides the crm utility called “crmsvcutil” to generate strongly typed classes that can be used in plugins.

10. Strongly typed classes has been changed to use like loosely typed classes.
Task task = new Task();
Task[“description”] = ”test description”

11. No more soap exception
catch (FaultException ex)

4 comments:

  1. What is the equivalent of the old CrmAuthenticationToken in Microsoft.Xrm.Sdk?

    Thanks.

    ReplyDelete
  2. There is no CrmAuthenticationToken in crm2011.
    The logic to connect to service has been changed,

    According to me.
    IServiceConfiguration is closest thing to CrmAuthenticationToken.

    ReplyDelete
  3. Microsoft Dynamics CRM training will help you manage and prioritize your business goals, customize.we teach MS Dynamics CRM training and class available at Hyderabad.

    ReplyDelete
  4. How do we impersonate an user in CRM 2013?

    ReplyDelete