protected override void Execute(CodeActivityContext executionContext) { IWorkflowContext context = executionContext.GetExtension <IWorkflowContext>(); //Create an Organization Service IOrganizationServiceFactory serviceFactory = executionContext.GetExtension <IOrganizationServiceFactory>(); IOrganizationService orgService = serviceFactory.CreateOrganizationService(context.InitiatingUserId); //Registered Step Guid var pluginStepGuid = Guid.Empty; var message = Message.Get(executionContext); //Plugin Image object CrmPluginImage pluginImage = new CrmPluginImage(); //pluginImage.AssemblyId = new Guid(""); //pluginImage.PluginId = new Guid(""); pluginImage.StepId = new Guid(PluginStepId.Get <string>(executionContext)); pluginImage.Attributes = Attributes.Get <string>(executionContext); pluginImage.ImageType = (CrmPluginImageType)ImageType.Get <int>(executionContext); pluginImage.EntityAlias = EntityAlias.Get <string>(executionContext); pluginImage.MessagePropertyName = message.Equals("Create") ? "Id" : "Target"; pluginImage.Name = Name.Get <string>(executionContext); pluginImage.CustomizationLevel = CustomizationLevel.Get <int>(executionContext); var imageId = pluginImage.CreatePluginImage(ref orgService); ImageId.Set(executionContext, imageId.ToString()); }
protected override void Execute(CodeActivityContext executionContext) { IWorkflowContext context = executionContext.GetExtension <IWorkflowContext>(); //Create an Organization Service IOrganizationServiceFactory serviceFactory = executionContext.GetExtension <IOrganizationServiceFactory>(); IOrganizationService orgService = serviceFactory.CreateOrganizationService(context.InitiatingUserId); //Registered Step Guid var pluginStepGuid = Guid.Empty; //Plugin Step object CrmPluginStep pluginStep = new CrmPluginStep(); pluginStep.StepId = new Guid(PluginStepId.Get <string>(executionContext)); pluginStep.UnsecureConfiguration = UnsecureConfiguration.Get <string>(executionContext); //Update Step pluginStep.UpdatePluginStep(ref orgService); }