Workflow 利用组进行工作流审批

Workflow 利用组进行工作流审批,workflow,kentico,usergroups,kentico-11,Workflow,Kentico,Usergroups,Kentico 11,我们正在现有网站上实施一个新的工作流(结合临时任务同步),我们希望通知“拥有”该特定部分/内容的所有成员批准更改 其中一个选项是为其角色和范围配置多个角色及其相应的工作流,但这似乎有些过火——至少对我们来说是这样,因为目前只有一个角色用于审批(另一个角色用于编辑) 然而,我最近遇到了这个新页面属性: 还有几个问题: 普通的CMS用户(没有会员资格)可以成为一个组的一部分吗 我们是否能够利用此组作为工作流的电子邮件通知,而不是角色?例如,当发送页面以供批准时,向所有者组中的所有人发送电子邮件

我们正在现有网站上实施一个新的工作流(结合临时任务同步),我们希望通知“拥有”该特定部分/内容的所有成员批准更改

其中一个选项是为其角色和范围配置多个角色及其相应的工作流,但这似乎有些过火——至少对我们来说是这样,因为目前只有一个角色用于审批(另一个角色用于编辑)

然而,我最近遇到了这个新页面属性:

还有几个问题:

  • 普通的CMS用户(没有会员资格)可以成为一个组的一部分吗
  • 我们是否能够利用此组作为工作流的电子邮件通知,而不是角色?例如,当发送页面以供批准时,向所有者组中的所有人发送电子邮件
  • 默认情况下,该选项是在创建新页面时从父页面继承的,还是需要为每个页面单独设置
我们拥有Kentico 11 EMS许可证,并且正在处理高级工作流,因此可以定制代码。

  • 普通的CMS用户(没有会员资格)可以成为一个组的一部分吗

    它不是CMS用户的一部分。小组成员来自于。

组:允许您管理用户组。团体是一种社交网络 使用户能够根据需要查找信息和进行通信的功能 为了共同的利益

  • 我们是否能够利用此组作为工作流的电子邮件通知,而不是角色?例如,当发送页面以供批准时,向所有者组中的所有人发送电子邮件

  • 默认情况下,该选项是在创建新页面时从父页面继承的,还是需要为每个页面单独设置

  • 普通的CMS用户(没有会员资格)可以成为一个组的一部分吗

    它不是CMS用户的一部分。小组成员来自于。

组:允许您管理用户组。团体是一种社交网络 使用户能够根据需要查找信息和进行通信的功能 为了共同的利益

  • 我们是否能够利用此组作为工作流的电子邮件通知,而不是角色?例如,当发送页面以供批准时,向所有者组中的所有人发送电子邮件

  • 默认情况下,该选项是在创建新页面时从父页面继承的,还是需要为每个页面单独设置

  • 普通的CMS用户(没有会员资格)可以成为一个组的一部分吗? -你为什么不在这里使用角色
  • 我们是否能够利用此组处理工作流的电子邮件 通知而不是角色?例如,发送电子邮件给社区中的每个人 发送页面进行审批时的所有者组。 -您需要自定义workflow manager类,但通常是可以的。你可以从中找到灵感
  • 默认情况下,当创建新页面时,此选项是否从父页面继承 一个是创建的,还是需要为每个页面单独设置? -使用宏来默认该字段。如果您使用任何其他内容填充它,则将保存新值
      • 普通的CMS用户(没有会员资格)可以成为一个组的一部分吗? -你为什么不在这里使用角色
      • 我们是否能够利用此组处理工作流的电子邮件 通知而不是角色?例如,发送电子邮件给社区中的每个人 发送页面进行审批时的所有者组。 -您需要自定义workflow manager类,但通常是可以的。你可以从中找到灵感
      • 默认情况下,当创建新页面时,此选项是否从父页面继承 一个是创建的,还是需要为每个页面单独设置? -使用宏来默认该字段。如果您使用任何其他内容填充它,则将保存新值

      工作流步骤(即拒绝和批准步骤)的自定义全局事件处理程序的示例代码段

      using CMS;
      using CMS.Base;
      using CMS.DataEngine;
      using CMS.DocumentEngine;
      using CMS.EmailEngine;
      using CMS.EventLog;
      using CMS.Helpers;
      using CMS.MacroEngine;
      using CMS.SiteProvider;
      using CMS.WorkflowEngine;
      using System;
      
      // Registers the custom module into the system
      [assembly: RegisterModule(typeof(CustomWorkflowEvent))]
      
      public class CustomWorkflowEvent : CMSModuleLoader
      {
          // Module class constructor, the system registers the module under the name "CustomInit"
          public CustomWorkflowEvent()
              : base("CustomInit")
          {
          }
      
          // Contains initialization code that is executed when the application starts
          protected override void OnInit()
          {
              base.OnInit();
      
              // Assigns custom handlers to events
              //  WorkflowEvents.Approve.After += WorkFlow_Event_After();
              WorkflowEvents.Reject.After += WorkFlow_Event_After;
              WorkflowEvents.Approve.After += Approve_After;
      
              // WorkflowEvents.Action.After += WorkFlowAction_Event_After;
      
          }
      
          private void Approve_After(object sender, WorkflowEventArgs e)
          {
              try
              {
                  WorkflowStepInfo wsi = e.PreviousStep;
                  if (wsi != null)
                  {
                      CMS.WorkflowEngine.Definitions.SourcePoint s = wsi.GetSourcePoint(Guid.NewGuid());
                      //Make sure it was an approval (standard) step
      
                      var approvers = WorkflowStepInfoProvider.GetUsersWhoCanApprove(wsi, null, SiteContext.CurrentSiteID, "UserID = " + CMSActionContext.CurrentUser.UserID, "UserID", 0, "Email, FullName, Username");
                      EventLogProvider.LogInformation("Approvers Data", "Approvers Data", approvers.ToString());
                      if (approvers != null)
                      {
                          //Loop through the approvers
      
                          string siteName = null;
                          SiteInfo si = SiteInfoProvider.GetSiteInfo(SiteContext.CurrentSiteID);
                          if (si != null)
                          {
                              siteName = si.SiteName;
                          }
      
                          EmailTemplateInfo eti = EmailTemplateProvider.GetEmailTemplate("Workflow.Rejected", SiteContext.CurrentSiteName);
      
                          MacroResolver mcr = MacroResolver.GetInstance();
      
      
                          EmailMessage message = new EmailMessage();
      
                          // Get sender from settings
                          message.EmailFormat = EmailFormatEnum.Both;
                          message.From = eti.TemplateFrom;
      
                          // Do not send the e-mail if there is no sender specified
                          if (message.From != "")
                          {
                              // Initialize message
                              // message.Recipients = strRecipientEmail;
                              message.Subject = eti.TemplateSubject;
      
                              // Send email via Email engine API
                              // EmailSender.SendEmailWithTemplateText(SiteContext.CurrentSiteName, message, eti, mcr, true);
                          }
                      }
      
                  }
              }
      
              catch (Exception ex)
              {
      
                  throw;
              }
      
          }
      
          private void WorkFlow_Event_After(object sender, WorkflowEventArgs e)
          {
              try
              {
                  WorkflowStepInfo wsi = e.PreviousStep;
                  if (wsi != null)
                  {
                      CMS.WorkflowEngine.Definitions.SourcePoint s = wsi.GetSourcePoint(Guid.NewGuid());
                      //Make sure it was an approval (standard) step
      
                      var approvers = WorkflowStepInfoProvider.GetUsersWhoCanApprove(wsi, null, SiteContext.CurrentSiteID, "UserID = " + CMSActionContext.CurrentUser.UserID, "UserID", 0, "Email, FullName, Username");
                      EventLogProvider.LogInformation("Approvers Data", "Approvers Data", approvers.ToString());
                      if (approvers != null)
                      {
                          //Loop through the approvers
      
                          string siteName = null;
                          SiteInfo si = SiteInfoProvider.GetSiteInfo(SiteContext.CurrentSiteID);
                          if (si != null)
                          {
                              siteName = si.SiteName;
                          }
      
                          EmailTemplateInfo eti = EmailTemplateProvider.GetEmailTemplate("Workflow.Rejected", SiteContext.CurrentSiteName);
      
                          MacroResolver mcr = MacroResolver.GetInstance();
      
                          EmailMessage message = new EmailMessage();
      
                          // Get sender from settings
                          message.EmailFormat = EmailFormatEnum.Both;
                          message.From = eti.TemplateFrom;
      
                          // Do not send the e-mail if there is no sender specified
                          if (message.From != "")
                          {
                              // Initialize message
                              // message.Recipients = strRecipientEmail;
                              message.Subject = eti.TemplateSubject;
      
                              // Send email via Email engine API
                              // EmailSender.SendEmailWithTemplateText(SiteContext.CurrentSiteName, message, eti, mcr, true);
                          }
                      }
      
      
      
      
                  }
              }
      
              catch (Exception ex)
              {
      
                  throw;
              }
          }
      
      }
      

      希望对您有所帮助。

      工作流步骤(即拒绝和批准步骤)的自定义全局事件处理程序的示例代码片段

      using CMS;
      using CMS.Base;
      using CMS.DataEngine;
      using CMS.DocumentEngine;
      using CMS.EmailEngine;
      using CMS.EventLog;
      using CMS.Helpers;
      using CMS.MacroEngine;
      using CMS.SiteProvider;
      using CMS.WorkflowEngine;
      using System;
      
      // Registers the custom module into the system
      [assembly: RegisterModule(typeof(CustomWorkflowEvent))]
      
      public class CustomWorkflowEvent : CMSModuleLoader
      {
          // Module class constructor, the system registers the module under the name "CustomInit"
          public CustomWorkflowEvent()
              : base("CustomInit")
          {
          }
      
          // Contains initialization code that is executed when the application starts
          protected override void OnInit()
          {
              base.OnInit();
      
              // Assigns custom handlers to events
              //  WorkflowEvents.Approve.After += WorkFlow_Event_After();
              WorkflowEvents.Reject.After += WorkFlow_Event_After;
              WorkflowEvents.Approve.After += Approve_After;
      
              // WorkflowEvents.Action.After += WorkFlowAction_Event_After;
      
          }
      
          private void Approve_After(object sender, WorkflowEventArgs e)
          {
              try
              {
                  WorkflowStepInfo wsi = e.PreviousStep;
                  if (wsi != null)
                  {
                      CMS.WorkflowEngine.Definitions.SourcePoint s = wsi.GetSourcePoint(Guid.NewGuid());
                      //Make sure it was an approval (standard) step
      
                      var approvers = WorkflowStepInfoProvider.GetUsersWhoCanApprove(wsi, null, SiteContext.CurrentSiteID, "UserID = " + CMSActionContext.CurrentUser.UserID, "UserID", 0, "Email, FullName, Username");
                      EventLogProvider.LogInformation("Approvers Data", "Approvers Data", approvers.ToString());
                      if (approvers != null)
                      {
                          //Loop through the approvers
      
                          string siteName = null;
                          SiteInfo si = SiteInfoProvider.GetSiteInfo(SiteContext.CurrentSiteID);
                          if (si != null)
                          {
                              siteName = si.SiteName;
                          }
      
                          EmailTemplateInfo eti = EmailTemplateProvider.GetEmailTemplate("Workflow.Rejected", SiteContext.CurrentSiteName);
      
                          MacroResolver mcr = MacroResolver.GetInstance();
      
      
                          EmailMessage message = new EmailMessage();
      
                          // Get sender from settings
                          message.EmailFormat = EmailFormatEnum.Both;
                          message.From = eti.TemplateFrom;
      
                          // Do not send the e-mail if there is no sender specified
                          if (message.From != "")
                          {
                              // Initialize message
                              // message.Recipients = strRecipientEmail;
                              message.Subject = eti.TemplateSubject;
      
                              // Send email via Email engine API
                              // EmailSender.SendEmailWithTemplateText(SiteContext.CurrentSiteName, message, eti, mcr, true);
                          }
                      }
      
                  }
              }
      
              catch (Exception ex)
              {
      
                  throw;
              }
      
          }
      
          private void WorkFlow_Event_After(object sender, WorkflowEventArgs e)
          {
              try
              {
                  WorkflowStepInfo wsi = e.PreviousStep;
                  if (wsi != null)
                  {
                      CMS.WorkflowEngine.Definitions.SourcePoint s = wsi.GetSourcePoint(Guid.NewGuid());
                      //Make sure it was an approval (standard) step
      
                      var approvers = WorkflowStepInfoProvider.GetUsersWhoCanApprove(wsi, null, SiteContext.CurrentSiteID, "UserID = " + CMSActionContext.CurrentUser.UserID, "UserID", 0, "Email, FullName, Username");
                      EventLogProvider.LogInformation("Approvers Data", "Approvers Data", approvers.ToString());
                      if (approvers != null)
                      {
                          //Loop through the approvers
      
                          string siteName = null;
                          SiteInfo si = SiteInfoProvider.GetSiteInfo(SiteContext.CurrentSiteID);
                          if (si != null)
                          {
                              siteName = si.SiteName;
                          }
      
                          EmailTemplateInfo eti = EmailTemplateProvider.GetEmailTemplate("Workflow.Rejected", SiteContext.CurrentSiteName);
      
                          MacroResolver mcr = MacroResolver.GetInstance();
      
                          EmailMessage message = new EmailMessage();
      
                          // Get sender from settings
                          message.EmailFormat = EmailFormatEnum.Both;
                          message.From = eti.TemplateFrom;
      
                          // Do not send the e-mail if there is no sender specified
                          if (message.From != "")
                          {
                              // Initialize message
                              // message.Recipients = strRecipientEmail;
                              message.Subject = eti.TemplateSubject;
      
                              // Send email via Email engine API
                              // EmailSender.SendEmailWithTemplateText(SiteContext.CurrentSiteName, message, eti, mcr, true);
                          }
                      }
      
      
      
      
                  }
              }
      
              catch (Exception ex)
              {
      
                  throw;
              }
          }
      
      }
      

      希望对您有所帮助。

      谢谢!除了为多个角色提供多个工作流之外,还有其他建议吗?您可以使用Kentico global events for workflow进行自定义实现。有关工作流全局事件,请参阅下面的URL-谢谢!除了为多个角色提供多个工作流之外,还有其他建议吗?您可以使用Kentico global events for workflow进行自定义实现。请参阅下面的URL了解工作流全局事件-啊,就是这样,我的要求与您的链接帖子完全相同,我们希望避免为此管理多个角色/工作流,而促使我想到所有者组的原因是,我们正试图避免为此类型添加自定义字段。我想结合你和@vasu下面的答案可能是解决这个问题的方法。虽然它完全没有经过测试,但我认为它是可行的。非常感谢你们两位的帮助。一旦我们开始测试,我将发布一个更新。啊,就是这样,我的要求与你的链接帖子完全相同,我们希望避免为此管理多个角色/工作流,而促使我想到所有者组的原因是,我们正试图避免为此类型添加自定义字段。我想结合你和@vasu下面的答案可能是解决这个问题的方法。虽然它完全没有经过测试,但我认为它是可行的。非常感谢你们两位的帮助。一旦我们开始测试,我会发布一个更新。