Hello All, I am trying to create an invoice from the opportunity while it will be WON, can anyone please help me to understand what’s wrong with the plugin code? Plugin Code – Register in WON – message/Opportunity – Entity : public void Execute(IServiceProvider serviceProvider) { ITracingService tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService)); // Obtain the execution context from the service provider. IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext)); IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory)); IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId); tracingService.Trace(“Out”); Guid opportunityId = Guid.Empty; if (context.InputParameters.Contains(“OpportunityClose”) && context.InputParameters[“OpportunityClose”] is Entity) { Entity entity = (Entity)context.InputParameters[“OpportunityClose”]; if (entity.Attributes.Contains(“opportunityid”) && entity.Attributes[“opportunityid”] != null) { EntityReference entityRef = (EntityReference)entity.Attributes[“opportunityid”]; if (entityRef.LogicalName == “opportunity”) { Guid OppID = entityRef.Id; tracingService.Trace(“id “+ OppID.ToString()); // Prepare Generate Invoice from Opportunity Request GenerateInvoiceFromOpportunityRequest generateInvoiceFromOpportunityRequest = new GenerateInvoiceFromOpportunityRequest(); generateInvoiceFromOpportunityRequest.OpportunityId = OppID; generateInvoiceFromOpportunityRequest.ColumnSet = new Microsoft.Xrm.Sdk.Query.ColumnSet(“name”, “customerid”); tracingService.Trace(“Run before generate invoice ” ); // Generate the Invoice GenerateInvoiceFromOpportunityResponse generateInvoiceFromOpportunityResponse = (GenerateInvoiceFromOpportunityResponse)service.Execute(generateInvoiceFromOpportunityRequest); } } } } Getting below error – Exception type: System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault] Message: The given key was not present in the dictionary.Detail: www.w3.org/…/XMLSchema-instance” xmlns=” “>schemas.microsoft.com/…/Contracts”> 469d75db-5481-412e-b1e5-0e231b72bd2b -2147220956 schemas.datacontract.org/…/System.Collections.Generic”> StepErrorDetails www.w3.org/…/XMLSchema” i:type=”d4p1:string”>[{“id”:”CREATE_QOI”,”status”:3},{“id”:”CREATE_QOI_PRODUCTS”,”status”:0},{“id”:”TRIGGER_PRICE_CALCULATIONS”,”status”:0},{“id”:”COPY_CONTACTS”,”status”:0},{“id”:”COPY_SHAREPOINT_DOCS”,”status”:0}] go.microsoft.com/…/ The given key was not present in the dictionary. 2023-01-04T21:18:33 false PluginExecution PluginExecution