示例#1
0
        private void SetError(CodeActivityContext context, TracingServiceLogWriter logWriter, string message)
        {
            logWriter.Log(Severity.Error, Tag, message);

            this.Error.Set(context, message);
            this.IsSuccessful.Set(context, false);
        }
示例#2
0
        /// <inheritdoc/>
        protected override void Execute(CodeActivityContext context)
        {
            if (context is null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var tracingSvc        = context.GetExtension <ITracingService>();
            var workflowContext   = context.GetExtension <IWorkflowContext>();
            var serviceFactory    = context.GetExtension <IOrganizationServiceFactory>();
            var orgSvc            = serviceFactory.CreateOrganizationService(workflowContext.UserId);
            var repositoryFactory = new RepositoryFactory(orgSvc);
            var logWriter         = new TracingServiceLogWriter(tracingSvc, true);

            logWriter.Log(Severity.Info, Tag, $"Executing integrated workflow activity.");

            try
            {
                var oDataClient = this.GetODataClient(context, workflowContext, logWriter);
                this.ExecuteWorkflowActivity(context, workflowContext, oDataClient, logWriter, repositoryFactory);
            }
            catch (InvalidPluginExecutionException ex)
            {
                this.SetError(context, logWriter, ex.Message);
            }
            catch (AggregateException ex) when(ex.InnerException is WebException)
            {
                this.SetError(context, logWriter, ex.InnerException.Message);
            }
        }
        /// <inheritdoc/>
        protected override void Execute(IPluginExecutionContext context, IOrganizationService orgSvc, TracingServiceLogWriter logWriter, RepositoryFactory repositoryFactory)
        {
            logWriter.Log(Severity.Info, Tag, "Injecting secure configuration into shared variables.");

            if (string.IsNullOrEmpty(this.SecureConfig))
            {
                throw new Exception("The secure configuration for the plugin step is empty.");
            }

            context.SharedVariables.Add(SharedVariablesKeySecureConfig, this.SecureConfig);
        }