What is Plugin using purpose Plugin writing Step

Plugin: -- A plug-in is custom business logic (code) that you can integrate with Microsoft Dynamics CRM 2011 and Microsoft Dynamics CRM Online to modify or augment the standard behavior of the platform. Another way to think about plug-ins is that they are handlers for events fired by Microsoft Dynamics CRM. You can subscribe, or register, a plug-in to a known set of events to have your code run when the event occurs.
Plugin tools Types: They are basically two types
A)     Preoperational  Plug-in (Asynchronous)
B)      Post operational plogin(Synchronous )

What is the purpose of plug in?
a.       Performing complex platform level data validation
b.      Performing auto-number generation
c.       Providing integration with other applications
d.      Executing complex business logic
e.      Data auditing and look up.
f.        Performing common database operations.

 syntax changes in Dynamics CRM 2011 plugins

1. The IPlugin now resides in Microsoft.Xrm.Sdk namespace instead of Microsoft.Crm.Sdk
public classClassName : Microsoft.Crm.Sdk.IPlugin
publicclassClassName : Microsoft.Xrm.Sdk.IPlugin

2. The Execute method signature of the IPlugin interface has changed; it now expects an IServiceProvider
instead of the IPluginExecutionContext.
publicvoid Execute(IPluginExecutionContext context)
publicvoid Execute(IServiceProviderserviceProvider)
3. To get a reference to the IPluginExecutionContext you now need to call the GetService method of the
IServiceProvider interface.
publicvoid Execute(IPluginExecutionContext context)
Microsoft.Xrm.Sdk.IPluginExecutionContext context =
(Microsoft.Xrm.Sdk.IPluginExecutionContext)
serviceProvider.GetService(typeof(Microsoft.Xrm.Sdk.IPluginExecutionContext));
4. ICrmService has been changed to IOrganizationService.
ICrmServicesdk = context.CreateCrmService(true);
IOrganizationServiceFactory factory = (IOrganizationServiceFactory)
serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationServicesdk = factory.CreateOrganizationService(context.UserId);
5. DynamicEntity has been changed to Entity.
·Properties property of DynamicEntity no longer exists
·Getting and Setting values no longer use *Property classes,
eg: no more KeyProperty, StringProperty…etc, simply do int value = (int)entity[“schema_name”];

if (context.InputParameters.Properties.Contains("Target") &&
context.InputParameters.Properties["Target"] isDynamicEntity)
if (context.InputParameters.Contains("Target") &&
context.InputParameters["Target"] isEntity)

Comments

Popular posts from this blog

Many to Many Relationship in Dynamics CRM 2011.

When to use plug-ins vs. workflow?

Create a Custom Workflow Activity...