
using Microsoft.Xrm.Sdk;using Microsoft.Xrm.Sdk.Query;using System;using System.Collections.Generic;using System.Linq;using System.Runtime.Remoting.Services;using System.Text;using System.Threading.Tasks;using System.Web.UI.WebControls;namespace PreOperationQualifyLead{ public class PreOperationQualifyLead : IPlugin { public void Execute(IServiceProvider serviceProvider) { ITracingService tracingService = null; try { var context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext)); tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService)); // Check if the message is QualifyLead if (context.MessageName != /QualifyLead/) { tracingService.Trace(/Plugin not triggered by QualifyLead message. Exiting plugin./); return; } var orgFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory)); var orgService = (IOrganizationService)orgFactory.CreateOrganizationService(context.InitiatingUserId); // Log the start of plugin execution tracingService.Trace(/PreOperationQualifyLead plugin execution started./); // Validate and retrieve input parameters if (context.InputParameters.Contains(/CreateAccount/) && context.InputParameters.Contains(/CreateContact/) && context.InputParameters.Contains(/CreateOpportunity/) && context.InputParameters.Contains(/Status/) && context.InputParameters.Contains(/Target/)) { var isCreateAccount = (bool)context.InputParameters[/CreateAccount/]; var isCreateContact = (bool)context.InputParameters[/CreateContact/]; var isCreateOpportunity = (bool)context.InputParameters[/CreateOpportunity/]; var status = (Int32)context.InputParameters[/Status/]; // Assuming Status is an integer var leadEntRef = (EntityReference)context.InputParameters[/Target/]; // Add custom logic to determine action based on parameters // For example, skip contact and account creation during Qualify process context.InputParameters[/CreateContact/] = false; context.InputParameters[/CreateAccount/] = false; // Log the completion of plugin execution tracingService.Trace(/PreOperationQualifyLead plugin execution completed successfully./); } else { // Log if required input parameters are missing tracingService.Trace(/One or more required input parameters are missing./); } } catch (Exception ex) { // Log any exceptions that occur during plugin execution if (tracingService != null) tracingService.Trace(/An error occurred: / + ex.ToString()); throw new InvalidPluginExecutionException(/An error occurred in the plugin./, ex); } } }}




Note: Opportunity is No by default, so this values is not thanks to the plugin!
There are no System Jobs or Plugin-trace logs in CRM, so I'm guessing it is not running at all. Any Help what should I do from here to troubleshoot this?