Posts

Showing posts from January, 2016

Modify Lead Qualification process in Dynamics CRM using C#: How to prevent Opportunity/ Account Creation and Refresh Lead Page On Lead Qualify

One condition on Lead Qualify could be like: If we don't want to create Opportunit/ Account or Contact on Lead Qualification that heppens by default. So for this secnario Below is the code which is required to stop creation of Opportunity/ Account on Qualifying Lead. Note: Register Plugin on "QualifyLead" message and Pre-Operation public void Execute(IServiceProvider serviceProvider)        {        AvoidOpportunityCreationOnLeadQualify(serviceProvider);      }        private void AvoidOpportunityCreationOnLeadQualify(IServiceProvider serviceProvider)      {        IPluginExecutionContext contextPlugin = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));        IOrganizationServiceFactory factory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));        IOrganizationService serviceDefaultUser = factory.CreateOrganizationService(contextPlugin.UserId);          OptionSetValue
go to top image