Send Workflow Notification Emails Using Workbench Email

Workbench Email allows site builders to configure emails that can be sent when the state of a piece content changes.The email subject and message are fully configurable from Drupal’s administration section, as well as defining which transition an email can be sent on.

This module is part of the Workbench suite, and it’ll require a basic setup of Workbench and Workbench Moderation.

In this video, we’ll configure Workbench Email to allow authors to send an email when the state changes from Draft to Needs Review and from Needs Review back to Draft.

Modules


drush dl workbench workbench_email workbench_moderation token

Resources

Transcript

Workbench Email allows site builders to configure emails that can be sent when the state of a piece content changes.The email subject and message are fully configurable from Drupal’s administration section, as well as defining which transition an email can be sent on.

This module is part of the Workbench suite, and it’ll require a basic setup of Workbench and Workbench Moderation.

In this video, we’ll configure Workbench Email to allow authors to send an email when the state changes from Draft to Needs Review and from Needs Review back to Draft.

Getting Started

Download and install the Workbench Email module. The module requires Workbench Moderation and Token.

I’ll assume you already have a basic setup of Workbench and Workbench Moderation. Configuring Workbench is outside of the scope of this video. If you need help with Workbench, review at the documentation page drupal.org

For my basic Workbench setup, I have two roles: writer and editor. A writer has permission to create an article and change the state to Needs Review. An editor can publish an article or move it back to a Draft state.

Configure Workbench Email

The first bit of work we’ll need to do is choose which transitions should send off an email.

Go to Configuration, “Workbench Moderation”and click on “Email Transitions” . Select which user role should receive an email for a specific transition. Select Editor for “Draft to Needs Review” and Writer for “Needs Review to Draft”.

If you can’t see any checkboxes on the “Email Transitions” page, this means you haven’t setup any roles or permissions to work with Workbench Moderation.

Now we’ll need to configure the emails that will be sent when the state changes. Click on Emails.

Click on “Draft To Needs Review” and “Email Editor”. For this video, we’ll enter in “title token” then “needs to be reviewed” as the subject. And, as the message we’ll use “Article title token needs to be reviewed.”

Also, don’t forget to configure the “Needs Review To Draft” email. Once you’re done, scroll to the bottom and click on “Save configuration”. Now we’ll open another browser and login as a “writer”.

Click on “Add content” and add a title and some body text. Scroll down and change the “Moderation state ” to “Needs review”.

A multi-select box will appear with a list of users who have the editor role assigned. Select a user who should receive a email. If you don’t want to send an email notification then just select “None”

If everything has been setup properly, the selected users should have received an email.

About the Author

Ivan is the founder of Web Wash and spends most of his time consulting and writing about Drupal. He's been working with Drupal for 10 years and has successfully completed several large Drupal projects in Australia.

Leave a Reply 2 comments

sailendra shakya - January 4, 2017 Reply

Hi, I have installed following modules for managing content flow process.
1. Workbench moderation
2. Workbench modules
3. Workbench email

Then after we have created three different roles like content_creator, first_approver and second_approver. After that we have created three different user for that roles.

Then we have given permission to different user according to the requirement. We have created one testing email template and assigned that email template to all Moderation state transitions. After that we created content from user content_creator and published it by user second_reviewer. Between these process, there must be atleast one email send to users but there is no any email flow during it.

We have also verified email flow from contact form and its working in contact us form.

Can you please help on it?

Thanks.

    Ivan Zugec - January 5, 2017 Reply

    Hi Sailendra,

    Debugging email issues in Drupal is difficult because there are so many moving parts.

    The way I’d debug this problem is:

    1. Make sure emails in general are being sent from Drupal, which you’ve mentioned is working.
    2. Set up workbench email without any crazy roles just enough to see emails being sent.
    3. If still no luck, try setting up workbench email in a freshly installed Drupal site. Other modules could be conflicting with it.

    Good luck.

    Cheers,
    Ivan

Leave a Reply: