Customize workflow notifications

Sitefinity's workflow pipeline sends email notifications when content is waiting for approval or when content is rejected. You may want to customize the default workflow notifications. For example, if you want to change the text of the email message, add or remove subscribers, or notify via another channel, such as SMS or the Dashboard. You can do this by injecting your own code into workflow notifications.

This tutorial demonstrates how you can add your code to the workflow notifications and this way, you can send custom email message and add another recipient to the list.
You can do it by descending from WorkflowNotifier and register you new class with the ObjectFactory. The example in the GitHub Custom Workflow Notifier repository is a fully functional class derived from the standard WorkflowNotifier.

WorkflowNotifier class

This class has 2 overridable methods:
  • void SendNotification(WorkflowNotificationContext) 
    This base class implementation generates the subject and the body of the email and sends the notification to the recipients. In this method, you can trigger your own notification and call the base implementation.
  • void BeforeEmailSend(WorkflowNotificationContext context, ref string subjectTemplate, ref string bodyTemplate, ref IDictionary<string, string> tokens, ref IEnumerable<ISubscriberRequest> subscribers) 
    This method executes upon sending the emails. In this method, you can update the subject and the body template of the email and also add, remove, or change a replacement token. In addition, you can change the list of subscribers or cancel email sending, if you empty the list.

 

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?