/// <summary> /// Executes the specified workflow. /// </summary> /// <param name="rockContext">The rock context.</param> /// <param name="action">The action.</param> /// <param name="entity">The entity.</param> /// <param name="errorMessages">The error messages.</param> /// <returns></returns> public override bool Execute(RockContext rockContext, WorkflowAction action, object entity, out List <string> errorMessages) { errorMessages = new List <string>(); HttpContext httpContext = HttpContext.Current; if (httpContext != null) { System.Web.UI.Page page = httpContext.Handler as System.Web.UI.Page; if (page != null) { var workflowEntryBlock = page.ControlsOfTypeRecursive <Rock.Web.UI.RockBlock>().Where(x => x.BlockCache?.BlockType?.Guid == Rock.SystemGuid.BlockType.WORKFLOW_ENTRY.AsGuid()).FirstOrDefault(); if (workflowEntryBlock != null) { workflowEntryBlock.PreRender += (sender, args) => { var notificationBox = workflowEntryBlock.ControlsOfTypeRecursive <Rock.Web.UI.Controls.NotificationBox>().Where(a => a.CssClass?.Contains("js-workflow-entry-message-notification-box") == true).FirstOrDefault(); if (notificationBox != null) { notificationBox.Visible = notificationBox.Visible && !GetAttributeValue(action, "HideStatusMessage").AsBoolean(); var index = notificationBox.Parent.Controls.IndexOf(notificationBox); if (index > -1) { notificationBox.Parent.Controls.AddAt(index + 1, new System.Web.UI.LiteralControl(GetAttributeValue(action, "HTML").ResolveMergeFields(GetMergeFields(action)))); } } }; } } } return(true); }
/// <summary> /// Executes the specified workflow. /// </summary> /// <param name="rockContext">The rock context.</param> /// <param name="action">The action.</param> /// <param name="entity">The entity.</param> /// <param name="errorMessages">The error messages.</param> /// <returns></returns> public override bool Execute(RockContext rockContext, WorkflowAction action, object entity, out List <string> errorMessages) { errorMessages = new List <string>(); HttpContext httpContext = HttpContext.Current; if (httpContext != null) { System.Web.UI.Page page = httpContext.Handler as System.Web.UI.Page; if (page != null) { RockBlock workflowEntryBlock = page.ControlsOfTypeRecursive <RockBlock>().FirstOrDefault(x => x.BlockName == "Workflow Entry"); if (workflowEntryBlock != null) { workflowEntryBlock.PreRender += (sender, args) => { NotificationBox notificationBox = workflowEntryBlock.ControlsOfTypeRecursive <NotificationBox>().FirstOrDefault(); if (notificationBox != null) { notificationBox.Visible = notificationBox.Visible && !GetAttributeValue(action, "HideStatusMessage").AsBoolean(); int index = notificationBox.Parent.Controls.IndexOf(notificationBox); if (index > -1) { notificationBox.Parent.Controls.AddAt(index + 1, new System.Web.UI.LiteralControl(GetAttributeValue(action, "HTML").ResolveMergeFields(GetMergeFields(action)))); } } }; } } } return(true); }