Quantcast
Channel: CRM Development Forum
Viewing all articles
Browse latest Browse all 888

cant update entity plugin crm 2011

$
0
0

hi i write a plugin that should perform the fields of custom entity but i cant update the enity.there is no error when i build the plugin.i can add the assemply succesfully and create update event on pre-operation mode in crm 2011 plugin reg tool.


here is my code.any helps plz?


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xrm.Sdk;
using System.ServiceModel;
using System.Diagnostics;

namespace Plug_ins
{
    public class Operationscorecardupdate : IPlugin
    {
        public void Execute(IServiceProvider serviceProvider)
        {

            Microsoft.Xrm.Sdk.IPluginExecutionContext context = (Microsoft.Xrm.Sdk.IPluginExecutionContext)
                serviceProvider.GetService(typeof(Microsoft.Xrm.Sdk.IPluginExecutionContext));


            if (context.OutputParameters.Contains("Target") &&
                context.OutputParameters["Target"] is Entity)
            {
                if (context.MessageName == "Update")
                {
                    //Code to be executed during Create event of an entity
                

               
                    Guid OppID = new Guid(context.InputParameters["id"].ToString());

                    IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
                    IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
                    Xrm.XrmServiceContext svcContext = new Xrm.XrmServiceContext(service);
                   //it is my function which update the records.

entityupdate(svcContext, service, OppID);

                }

            }

        }


Crm Software Specialist


Viewing all articles
Browse latest Browse all 888

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>