Exemplo n.º 1
0
        private Guid UpsertSdkMessageProcessingStep(Guid parentId, Step step, string solutionName, RegistrationTypeEnum registrationType)
        {
            Guid Id = step.Id ?? Guid.Empty;

            if (Id == Guid.Empty)
            {
                Id = pluginRepository.GetSdkMessageProcessingStepId(parentId, step.Name);
                logWarning?.Invoke($"Extracted id using plugin step name {step.Name}");
            }

            var sdkMessageId             = pluginRepository.GetSdkMessageId(step.MessageName);
            var sdkMessageFilterId       = pluginRepository.GetSdkMessageFilterId(step.PrimaryEntityName, sdkMessageId);
            var sdkMessageProcessingStep = new SdkMessageProcessingStep()
            {
                Name                    = step.Name,
                Description             = step.Description,
                SdkMessageId            = new EntityReference(SdkMessage.EntityLogicalName, sdkMessageId),
                Configuration           = step.CustomConfiguration,
                FilteringAttributes     = step.FilteringAttributes,
                ImpersonatingUserId     = new EntityReference(SystemUser.EntityLogicalName, pluginRepository.GetUserId(step.ImpersonatingUserFullname)),
                ModeEnum                = step.Mode,
                SdkMessageFilterId      = new EntityReference(SdkMessageFilter.EntityLogicalName, sdkMessageFilterId),
                Rank                    = step.Rank,
                StageEnum               = step.Stage,
                SupportedDeploymentEnum = step.SupportedDeployment,
                EventHandler            = new EntityReference(PluginType.EntityLogicalName, parentId),
            };

            Id = ExecuteRequest(registrationType, Id, sdkMessageProcessingStep);

            AddComponentToSolution(Id, ComponentType.SDKMessageProcessingStep, solutionName);
            return(Id);
        }
Exemplo n.º 2
0
        public Guid UpsertSdkMessageProcessingStep(EntityReference parentRef, Step step, string solutionName, RegistrationTypeEnum registrationType)
        {
            Guid Id = step.Id ?? Guid.Empty;

            if (Id == Guid.Empty)
            {
                Id = pluginRepository.GetSdkMessageProcessingStepId(parentRef.Id, step.Name);
                logWarning?.Invoke($"Extracted id using plugin step name {step.Name}");
            }

            var sdkMessageId             = pluginRepository.GetSdkMessageId(step.MessageName);
            var sdkMessageFilterId       = pluginRepository.GetSdkMessageFilterId(step.PrimaryEntityName, sdkMessageId);
            var sdkMessageProcessingStep = new SdkMessageProcessingStep()
            {
                Name                    = step.Name,
                Description             = step.Description,
                SdkMessageId            = new EntityReference(SdkMessage.EntityLogicalName, sdkMessageId),
                Configuration           = step.CustomConfiguration,
                FilteringAttributes     = step.FilteringAttributes,
                ImpersonatingUserId     = new EntityReference(SystemUser.EntityLogicalName, pluginRepository.GetUserId(step.ImpersonatingUserFullname)),
                ModeEnum                = step.Mode,
                SdkMessageFilterId      = new EntityReference(SdkMessageFilter.EntityLogicalName, sdkMessageFilterId),
                Rank                    = step.Rank,
                StageEnum               = step.Stage,
                SupportedDeploymentEnum = step.SupportedDeployment,
                EventHandler            = parentRef,
                AsyncAutoDelete         = step.AsyncAutoDelete,
            };

            Id = ExecuteRequest(registrationType, Id, sdkMessageProcessingStep);
            int stateCode = (int)step.StateCode;

            organizationService.Execute(new SetStateRequest
            {
                EntityMoniker = new EntityReference(sdkMessageProcessingStep.LogicalName, Id),
                State         = new OptionSetValue(stateCode),
                Status        = new OptionSetValue(stateCode + 1)
            });

            AddComponentToSolution(Id, ComponentType.SDKMessageProcessingStep, solutionName);
            return(Id);
        }