Too to use:
CRM plugin Registry tool 2011
steps:
1. visual studio 2010
New > Project > Class library > "Name your plugin"
2. Add References (Verweise) : microsoft.xrm.sdk from your sdk installed location
Ready now !
3. Name your class like : public class XYZ : IPlugin
4. Start with the following code to have the talk with your CRM. The function Execute is your starting point.
public void Execute(IServiceProvider serviceProvider)
{
IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
if (!context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity) return;
Entity entity = (Entity)context.InputParameters["Target"];
// if (entity.LogicalName != "account") return;
try
{
#region init
IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
this.service = serviceFactory.CreateOrganizationService(context.UserId);
Entity oEntity = context.PostEntityImages["img"];
#endregion
}
}
-Every edit in the code requires update in the Plugin Reg too
-Prior to Every debug needs to attach (anhängen) the exe file from Debug>process attach
5. What is oEntity ? This is an image for your post entries to a textfield (for example). The edits you do after the entity loads.
Only the fields those being affected are considered, therefore the changes are recorded as an image. You need to register this image as well as the events (for ex. update and create of an entity) along with the project's successful build file.
For details: http://msdn.microsoft.com/en-us/library/gg309580.aspx
Connect CRM : http://crm234
a. Register a Plug-in Assembly
b.Location example : C:\Program Files\Microsoft Dynamics CRM\Server\bin\assembly\ ...dll or (pdb)
c. Register the Plug-in for an Event
d. we set the plugin as asynchronous. Which means the plugin actions won't effect on priority saving; so that it won't make the system slow.
6. To debug (Erstellen) add a file named copy.cmd inside \bin\debug and type like:
xcopy "XYZ.dll" "C:\Program Files\Microsoft Dynamics CRM\Server\bin\assembly" /y /v
xcopy "XYZ.pdb" "C:\Program Files\Microsoft Dynamics CRM\Server\bin\assembly" /y /v
-- Right click prject>properties>Buildereignis>type : copy.cmd in the region : Befehlszeile für Postbuildereignis
--Here the successful builds (.dll) and the project file (.pdb) will be overwritten
--CRM server gonna use this .dll file for the targeted execution.
7. Signature (Signiung): Must be set default which is user specific.
Install plugin to CRM
*********************
Remember where you kept your XYZ.dll file
1. Go to solution > Plugin Assemblys > Add Existing Elements> Add XYZ.dll file to the solution
2. click>SDK message>Add your Registered events (create,update)