Software upgrades not only bring enhancements, they do break the existing syntax and cause frustration while upgrading to the new version. MS CRM 2011 is no exception to this, as many changes were applied to the way plugins and workflows are developed. While MS CRM 4.0 has its own syntax, CRM 2011 introduced many more additions and altered the syntax significantly.
While we were upgrading the plug-ins and workflows from MS CRM 4.0 to 2011, these syntactical changes took some time to deal with the upgrade process smoothly. During this process, we’ve noted many such changes and compiled them in as orderly manner as possible.
1) References
We no longer use the Microsoft.Crm.* DLLs, as the namespace had a complete makeover. MS CRM 2011 introduced a brand new namespace “XRM”, hence the DLLs to use are Microsoft.Xrm.*
Since the changes in MS CRM 2011 SDK are using WCF based services (compared to the web services used by its predecessor), we must reference the below mentioned:
o System.ServiceModel o System.Runtime.Serialization
A reference to the “Microsoft.IdentityModel” DLL is a must if the plugin is targeted at MS CRM 2011 online version.
2) Executing Execute method now uses IServiceProvider. |
CRM 4.0 | CRM 2011 |
public void Execute(IPluginExecutionContext context) | public void Execute(IServiceProvider serviceProvider) |
3) IPluginExecutionContext
Similar to the “Execute” method retrieving the context object inside a plugin also changed: IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
4) CRM Service
In CRM 2011, ICrmService is replaced by IOrganizationService
5) DynamicEntity has been changed to Entity
Similarly “Properties” of a CRM entity now have to be accessed using the “Attribute” collection:
entity.Attributes.Contains("new_incidentnumber") |
Below given template can be used to create a plugin for the MS CRM 2011
namespace MyPlugin Next time, we’ll be listing all the syntax changes made in the custom workflow activities.
Presented By www.Osmosys.asia
|
No comments:
Post a Comment