Beispiel #1
0
        public void Process(WorkflowPipelineArgs args)
        {
            Item   contentItem     = args.DataItem;
            string workflowComment = (!string.IsNullOrEmpty(args.CommentFields[Constants.Comments])) ? args.CommentFields[Constants.Comments] : Constants.NoComment;

            try
            {
                using (new SecurityDisabler())
                {
                    Item notifyStepItem      = args.ProcessorItem.InnerItem;
                    Item currentWorkflowStep = WorkflowHelper.GetCurrentState(args); // Current workflow state
                    Item nextWorkflowStep    = WorkflowHelper.GetNextState(args);    // Next workflow state

                    var from = notifyStepItem.Fields[Templates.NotifyNextStepUser.Fields.From].Value;
                    var emailTemplateItem = notifyStepItem.TargetItem(Templates.NotifyNextStepUser.Fields.EmailTemplate);
                    var receivers         = GetReceivers(contentItem, currentWorkflowStep.ID, nextWorkflowStep.ID);

                    _workflowNotifyService.SendEmailNotifications(receivers, from, contentItem, workflowComment, emailTemplateItem);
                }
            }
            catch (Exception ex)
            {
                Log.Error($"NotifyNextStepUser: {ex}", this);
            }
        }