Thursday, 6 December 2012

plugin using by Developer tool kit

Developer tool kit :
sdk-- tools-- developer toolkit.

we need to install the developer toolkit.
for this first we can install WIF
we can download and install.
after that install the developer tool kit.

open the Visual Studio you will get the Dynamic crm tab.
choose the new visual studio solution template.
give the name and click on ok.
you will get the connection:
give the server name. (crmsever).
choose http or https.
default credentials.
then  select the organization and solution.
click ok.
automatically it will show the crm
right click on entity and create wrapper class ( early bound).
it will come as entity.cs near by plugin.cs.
use the namespace in using area.
select the entity where we need to create plugin.
right click and select the create plugin option.
there we need to give the plugin message.
give the signing.
click on project and deploy.

sample code :

IPluginExecutionContext context = localContext.PluginExecutionContext;
            IOrganizationService service = localContext.OrganizationService;
            var orgServiceContext = new OrganizationServiceContext(service);

            if (context.InputParameters.Contains("Target") &&
                             context.InputParameters["Target"] is Entity)
                // Obtain the target entity from the input parmameters.
                Entity entity = (Entity)context.InputParameters["Target"];
                // TODO: Implement your custom Plug-in business logic.
                var newCooldrink = entity.ToEntity<new_cooldrink>();
                newCooldrink.new_productcount = 50;


No comments:

Post a Comment