Workflow in Action - setup email notifications

Hi all! As workflow for Liferay 6.1 sligtly changed from workflow in Liferay 6, I'll spent some time to provide ways to setup it and use it. My idea here is describe how fast you can setup and apply Liferay workflow to your business. I'll to write series of blogs with cases describing how to apply workflow in publishing, banking or city government.

Before I start hassle with problems you are realy interested in I'll describe how to configure and test basic modules neccessary to achieve the final one. Yes it is technical stuff, but we must "build crane to build a crane".

Setup Email Notification and test it with Web Content Management

 
For purposes of this demonstration we will need:
  • two users + administrator
  • email accounts for both users (example is done with gmail accounts - I'm using my private and companys email)
  • existing built in Liferay site,
  • installed kaleo web plugin
 

STEP 1 - Create users

User1: Clark Kent that will be able to add web Content scoped to Liferay site
User2: Loise Lane that will be given Site Content Reviewer Role
 

STEP 2 - setup email server to enable notifications

I will use gmail to demonstrate email services setup as most of us have gmail account.
  • Go to Control Panel
  • In left menu go to Server section and click Server Administration
  • Choose Mail tab
  • Incoming POP Server set to pop.gmail.com and port to 995
  • Check Use Secure Network Connection
  • Username set to your email address (eg. clark.kent@gmail.com)
  • Outgoing SMTP Server set to smtp.gmail.com and port to 465
  • Check Use Secure Network Connection
  • Username set to your email address (eg. clark.kent@gmail.com)
When setting Outgoing SMTP Server be aware that some ISPs will prevent you to use your custom email server as outgoing server (even via secure connection). So you will need to set this attributes according ISP rules.
portal-ext.properties that have to be set are:
pop.server.notifications.enabled=true
pop.server.notifications.interval=1
 

STEP 3 - Kaleo workflow

Now we will activate workflow for Web Content Management so before make sure you have deployed Kaleo Web plugin. (developers: go to your liferay-plugins repository, position to webs/kaleo-web and type ant deploy; other: download plugin and copy it to liferays deploy folder)
  • Go to Control Panel
  • In left menu go to Portal section and click Workflow
  • Choose Definitions tab
  • Make sure you have listed Single Approver workflow model and if not add it
  • Activate Single Approver workflow
  • In Control Panels left menu make sure Liferay site is in the scope. In Liferay section click Workflow Configuration
  • For Web Content from drop down at the right choose Single Approver (Version 1) and click Save
 

STEP 4 - setup Web Content Notifications

It is good to know that WCM notifications are optional and in current 6.1 relese. If you enable it you will receive both Kaleo and WCM notifications.
If you have no workflow enabled for Web Content Management, tabs in Configuration screen related to workflow notifications wont be available.
Now, when Kaleo is ON, we will setup user notifications for Review Request for reviewer and Article Granted notification for author.
  • Go to Control Panel
  • Make sure that in left menu scoped site is Liferay
  • In Liferays site section click Web Content
  • In the right side of opened page click Options icon and choose Configuration to open Web Content Configuration pop-up
  • Email From Tab - fill in Name (Workflow Liferay) and Email address (workflow@liferay.com) that will show up as notification email sender. Click Save.
  • Web Content Granted Email Tab - Check Enabled checkbox and depending your needs adopt email template. Be careful with template variables that will be substituted with real values in runtime. Meaning of each variable is explained below template. Click Save
  • Web Content Review Email Tab - Check Enabled checkbox and depending your needs adopt your email template with "Article url: [$ARTICLE_URL$]" at the end of the body. Click Save.

STEP 5 - Now we are ready to do some work

User Clark Kent
  • Sign in as Clark Kent
  • Go to Control Panel
  • Make sure Liferay site is in the scope and click Web Content
  • In Web Content tab click Add
  • Enter Title enter Body click Submit for Publication
User Administrator
Now person that has role able to Approve Web Content articles will get an email with request and link to target web content (Figure1). Lets say it is an administrator. Administrator does next
  • Go to Control Panel
  • Click My Workflow Tasks in the left menu
  • Since administrator is not explicitly assigned for Review he will see pending request into "Assigned to My Roles" section.
  • From Action menu select Assign To and in pop-up window chose user Loise Lane and write down comment (something like Please do review we are in hurry...)
 
User Loise Lane - already received email notification from Liferay Workflow engine that review request is waiting for her.
  • Sign in as Loise Lane
  • Go to Control Panel
  • Click My Workflow Tasks in the left menu
  • You will se pending request - from Action menu choose Approve and in pop-up dialog write down comment "Clark you impress me each time" and click Approve
 
In this moment Web Content Article is Approved and author Clark Kent recives email:
In this moment your email notifications are ready and we can start building more interesting case.

Useful links

Blogues
Cool feature Igor...We had been waiting for email feature for long time...Is there a way by which we can change this email content?
Thanks,
Jay.
[...] Liferay Workflow provides a lot of features, one of which is notifications. When a workflow item lands in your queue, you want to know about it. Configure email notifications using this handy... [...] Read More
Hi ,
Can we stop/disable the sending a mail notifications when webcontent is created/updated.

Regards
Ram A
Is it possible to include the "comment pop-up" content in email?
In kaleo definition, this field is accessible from ${taskComments} variable.
How about it in Liferay WC configuration section?

Thanks
hey..can this be done the same way in liferay 6.2 as well..I've been trying to set up email notifications for liferay 6.2 but have been having problems..there is no option for the email tab in my web content configuration. Please help.
Hi Supreet, for 6.1 you have 2 different sources for notifications. WCM and Kaleo. You can enable/disable notifications in portal properties so please be careful about it.
For 6.2 I participated in notification reorganization and it was long time ago so don't take this for true: there was intention to remove notification management from WCM so that Kaleo is central and only point for workflow management.
Thanks. What I need to do is send reminder email to the approver of web content one day before the web content is scheduled to expire. How can I do that in liferay 6.2? I created a scheduler but how can I get the expiry date of a web content article and how can I send mail to the approver? Please help.
I need the following:

- Shortly before the password of an user expires, the user needs to be informed via an email. This email needs to contain an URL that enables the user to change his password.

- If the user didn't change his password and his password has expired, the user needs to be able to change his password (only a few days after expiration).


Does anyone know if this kind of email notifications will be sent in 6.1.2?