« Back

Liferay Workflow In Action

Company Blogs July 13, 2010 By Juan Fernández Staff

Hi guys!

One of the many great improvements of Liferay 6 is the workflow system, as many of you already know. We have been working hard on it and we have developed lots of new functionallities that we're sure you'll love.

In this blog post I'll implement a use case so that you can see workflow in action, and by the way, I announce that in the wiki we've created a series of articles that describe the workflow portlets and what are they for. You can read them by clicking in this wiki link: http://www.liferay.com/es/community/wiki/-/wiki/Main/Workflow

Intro:

In this example we will create the following users:

            Reader: this is a simple user that is a member of the community "My Use Case Community"

            Content Writer: this is the content writer of the community. He's able to create web content

            Content Reviewer: this is the person in charge of controling the content that is going to be published. He can decide if the web content is correct or not.

            Content Publicator: this is the member of the community that publishes content, add new applications to the community and so on.

            Portal Admin: super user that will prepare the environment of this use case

 

Configure the environment:


With the portal admin, I create "My Use Case Community" and the four users, which I assign to the community as new members.


Assign roles and permissions:

            Assign the "Community Content Reviewer" role (which is an autogenerated role from the workflow definition) to the user "Content Reviewer", so that he can review content

            Assign the "Community Administrator" role to "Content Publicator" so that he can manage everything in the community

            Create a new community role called "Content Writer" and assign it to "Content Writer". This role would have web content's permissions (I don't usually give him "delete" and "permission" permissions, but that's up to you) and access in control panel, so that he can create web content from the control panel (this is not strictly necessary, as he can create web content from the asset publisher, for example)

 

Important: Enable the workflow for this community's web contents: Go to "Control Panel", "Workflow configuration" and select your workflow definition (by default kaleo provides "Single Approver" definition) in the "Web content" entry.

Now, let's start working!

The workflow system in action:

           1.- Creating the content

Login as the "Content Writer", go to the control panel and create a new web content. Notice that the available buttons are "Save as draft" and "Submit for publication", so that the user knows that he can't publish directly (by the way this is a good way to know that the workflow engine is correctly applied to your community). Click "Submit for publication".

 



In this moment, the workflow engine starts. The user can see that the content's status is "pending" and he can't modify the content till it's reviewed.
From this moment on, the content writer can follow the process in the "My Submissions" portlet. There he can see the internal workflow status and if he realizes (for example) that he wants to modify something in the content, he can withdraw the submission.

               2.- Reviewing the content

It's time for the "Content Reviewer" to start working.
The main part of the reviewer work is going to be done in the "My Workflow Tasks" portlet, so let's go there.
In the "Assigned to my roles" view, you'd see the pending tasks and you can assign the task to another user or yourself.



 

I assign it to myself




 

In the detail view of the task, you can view and edit the content, read the recent activity of the task, view the status and change its status (in this case approve or reject, but this would depend on the workflow definition)




In this moment, there are two possibilities:
            a) The reviewer rejects the content: he writes the reason in a popup and the content goes back to the writer, so that he can edit/fix/improve it
            b) The reviewer approves the content: he (maybe after editing the content so that it fits the portal's rules) approve the content and the content's status is updated to "approved".

                   3.- Publish the content

The user "Content Publicator", that handles the portlets and has publishing rights, now can go to the community pages and add a web content display portlet with the new content in it

                   4.- Access the content

The user "Reader" (who, remember, has no special permissions, but is a community member) is now able to view the new web content




 

Remember that, out-of-the-box, liferay 6 provides the hability to enable workflow for these entities:
         1. Wiki Page
         2. Web Content
         3. Document Library Document
         4. Blogs Entry
         5. Comments
         6. Message Boards Message

And you can extend this functionallity to your custom portlets.

We are looking forward to hearing your feedback!

Regards,
Juan Fernández
Liferay Core Engineer

Threaded Replies Author Date
Thanks for the example Juan! very cool! Julio Camarero July 13, 2010 6:39 AM
Great Post Man! I really liked the example. Marcellus Tavares July 13, 2010 11:15 AM
Will there be a liferay-portal-6.0.3 on... Hans-Joachim Matheus July 14, 2010 2:04 AM
Thanks for sharing this example Nidhi Singh July 15, 2010 3:27 AM
Where on source code is this default workflow... Heimo Laukkanen August 5, 2010 11:20 PM
Hi, At the first look: It seems the employed... Asghar Rahmani August 24, 2010 9:36 PM
Hi Juan , Fantastic post! very useful.... Arun Kumar Ramachandran October 12, 2010 3:03 AM
Hi Arun: We don't have documentation about this... Juan Fernández October 18, 2010 3:02 AM
Hi Juan, Do you know where can I find any... unai alba October 18, 2010 2:54 AM
Hi Unai: the best way to know how to define a... Juan Fernández October 18, 2010 2:59 AM
Hi Juan, your article it's very interesting. I... Denis Signoretto November 3, 2010 3:36 AM
No There is not Binh Thanh Le November 30, 2010 3:31 AM
Hi All I change default workflow engine to... Seyed Mohammad Hossein Jamali December 19, 2010 5:24 AM
Hi Seyed: this is not the best place to post... Juan Fernández December 20, 2010 12:28 AM
Hi Juan Ok :) Liferay doesn't generate any... Seyed Mohammad Hossein Jamali December 20, 2010 5:03 AM
hi,I have cleaned liferay 6.0.5 from kaleo-web... Bradai Salma February 26, 2011 1:54 AM
Hi Jonas, is there Activiti... Denis Signoretto February 28, 2011 12:41 AM
Hi everyone! I'm looking for information about... Jairo Luna May 16, 2011 4:25 PM
Hi Jairo! You got a lot of info in the... Juan Fernández May 17, 2011 12:16 AM
Hi, I am not able to implement KALEO work flow... Ramesh K July 7, 2011 2:29 PM
Hi, I found a problem when you include a link... Mati-ur-Rehman Khan July 25, 2011 6:09 AM
Thanks Juan for sharing this.. I want to... Jay Patel December 2, 2011 2:24 PM
[...] Hi all! As workflow for Liferay 6.1... Anonymous January 11, 2012 7:31 AM
Hi Juan Fernández, You have given very nice... Keyur Ashra February 26, 2012 10:19 PM
One more thing which i would like to know in... Keyur Ashra February 28, 2012 10:47 PM
thxs, GREAT Serdar Ayalp March 7, 2012 4:25 AM
Hi Juan! Im using Lifray 6.1 CE GA1 source and... Hung Dx June 5, 2012 9:20 PM
Hi Hung: why do you installed the old version... Juan Fernández June 5, 2012 11:25 PM
Hi Juan! Im trying to find kaleo-web version... Hung Dx June 6, 2012 8:01 PM
are you familiar with Liferay workflow... kevin wu August 2, 2012 3:08 AM
Hi Kevin: have a look at this wiki page -... Juan Fernández August 2, 2012 3:10 AM
Hi, I am using Liferay 6.0 with kaleo-web. Now... Ram A February 22, 2013 1:07 AM
Hi I want to use this functionality for my... Kannan G krishnan September 29, 2013 11:44 PM
Hi I want to use this functionality for my... Kannan G krishnan September 29, 2013 11:44 PM
Hi I want to use this functionality for my... Kannan G krishnan September 29, 2013 11:44 PM
Hi I want to use this functionality for my... Kannan G krishnan September 29, 2013 11:44 PM
Hi I want to use this functionality for my... Kannan G krishnan September 29, 2013 11:44 PM
Hi I want to use this functionality for my... Kannan G krishnan September 29, 2013 11:44 PM
Hi I want to use this functionality for my... Kannan G krishnan September 29, 2013 11:44 PM
Hi I want to use this functionality for my... Kannan G krishnan September 29, 2013 11:45 PM
Hi I want to use this functionality for my... Kannan G krishnan September 29, 2013 11:45 PM
Hi I want to use this functionality for my... Kannan G krishnan September 29, 2013 11:45 PM
Hi I want to use this functionality for my... Kannan G krishnan September 29, 2013 11:45 PM
Hi Juan , Please support me to apply kaleo... Chiến Ngọc October 20, 2013 9:47 PM
Hi Instead of going to 'my workflow tasks', can... Abhay Chaware April 18, 2014 5:34 AM

Thanks for the example Juan! very cool!
Posted on 7/13/10 6:39 AM.
Great Post Man! I really liked the example.
Posted on 7/13/10 11:15 AM.
Will there be a liferay-portal-6.0.3 on Sourceforge?

AND:
Will there be a kaleo-web-6.0.3 or a jbpm-web-6.0.3 plugin on Sourceforge for download?

SVN access here in germany is awfully slow!
Posted on 7/14/10 2:04 AM.
Thanks for sharing this example
Posted on 7/15/10 3:27 AM.
Where on source code is this default workflow defined?
Posted on 8/5/10 11:20 PM.
Hi,
At the first look: It seems the employed ORM Framework in LRP Server V 6.0 (hibernate)doesn’t correctly handle the SQL statements of Oracle 10 G …
Maybe helpful, if you use another version of Oracle DBMS in the actual environment, possibly for an easy and fast “solution”. (I’m a newcomer to LRP server, just a few weeks evaluation - level experiences with LRP Server V 5.3. I also don’t know Oracle DBMS and what is it`s actual version…). Now I´m reading some online sources about the LRP Server V 6.0.
Asghar
Posted on 8/24/10 9:36 PM.
Hi Juan ,
Fantastic post! very useful. May i know the procedure to add the workflow for custom portlets.It will be useful for me and for feature visitors.

Thanks
Arun
Posted on 10/12/10 3:03 AM.
Hi Juan,

Do you know where can I find any documentation about Kaleo? I need to define a workflow only for a few roles not for all, so I need to define a conditional node, Does Kaleo support it? How can I implement it?

Thanks.
Posted on 10/18/10 2:54 AM.
Hi Unai:
the best way to know how to define a workflow definition is reading the related DTD/XSD (http://svn.liferay.com/browse/portal/trunk/definitions/liferay-workflow-definit­ion_6_1_0.xsd?r=HEAD)
Posted on 10/18/10 2:59 AM in reply to unai unai.
Hi Arun:
We don't have documentation about this process yet.
The easiest way is to analyze how we did it to our portlets.
In a nutshell, all you have to do is to create a status field in your entity and then call the workflow API in XXXLocalServiceImpl as we did in (for example) BlogsEntryLocalServiceImpl in add, update and delete methods
Posted on 10/18/10 3:02 AM in reply to Arun Kumar Ramachandran.
Hi Juan,

your article it's very interesting. I would like understand the workflow capabilities of Liferay. In particular the different alternatives about: kaleo, jbpm and if the SAW API are still used as common interface between different workflow engines.

Is there related documentation or an introductive blog about it?

Thanks,
Denis.
Posted on 11/3/10 3:36 AM.
No There is not
Posted on 11/30/10 3:31 AM in reply to Denis Signoretto.
Hi All

I change default workflow engine to JBPM3 (in liferay 6.0.5). i can see workflow items of ControlPanel such as Workflow Configuration and My Workflow Tasks but i cannot add new workflow definition! liferay say me : "You have entered invalid data. Please try again. " and "Please enter a valid file. "

i use single-approver-definition.xml but it doesn't add anything!

it seams Liferay works with Kaleo fine but it doesn't works with JBPM3 properly !

Do you have any suggestion ??
Thanks
S.M.H.Jamali
Posted on 12/19/10 5:24 AM in reply to Binh Thanh Le.
Hi Seyed:
this is not the best place to post your errors. Why don't you create a new forum thread and then post the stack trace so that it's easier to help you?
Thanks
Juan
Posted on 12/20/10 12:28 AM in reply to Seyed Mohammad Hosein Jamali.
Hi Juan
Ok emoticon

Liferay doesn't generate any stack trace for this issue. although it shows error message simple approval definition applied and is representable in Workflow Configuration.

sorry for choosing wrong location of posting
best regards
S.M.H.Jamali
Posted on 12/20/10 5:03 AM in reply to Juan Fernández.
hi,I have cleaned liferay 6.0.5 from kaleo-web
and deployed jbpm4.4
since i didn't find a good tutorial for a simple test,ihave tried this one although it's for kaleo,
the problem is the reviewer can't reject or approve the content,when i click on actions there is only assing to me,assing to..,Apdate Due date ,
is that mean thas my workflow engine doesn't work ?
Posted on 2/26/11 1:54 AM in reply to Seyed Mohammad Hosein Jamali.
Hi Jonas,

is there Activiti http://activiti.org/ support as a workflow engine for Liferay (or is it planned)?

Thanks, Denis
Posted on 2/28/11 12:41 AM.
Hi everyone! I'm looking for information about email workflow notifications, I don't really know how does it work and/or how can I activate it, do any have some suggestion? thanks in advance.
Posted on 5/16/11 4:25 PM.
Hi Jairo! You got a lot of info in the administration guide (http://www.liferay.com/es/documentation/liferay-portal/6.0/administration/-/ai/­workflow-with-kaleo)
Anyway, you can always notify via email in your workflow tasks by adding a new "notification":

<notification>
<name>Creator Modification Notification</name>
<execution-type>onAssignment</execution-type>
<template>Your submission was rejected by a reviewer, please modify and resubmit.</template>
<template-language>text</template-language>
<notification-type>email</notification-type>
</notification>
Posted on 5/17/11 12:16 AM in reply to Jairo Luna.
Hi,
I am not able to implement KALEO work flow in oracle 10g. I tried all the scenarios which I found in web but no luck. Inconsistent data type: got CLOB expected. Thanks in anticipation.
Posted on 7/7/11 2:29 PM.
Hi,
I found a problem when you include a link from document library or image library into a web content and try to approve web content it doesn't work. It is removed from Assigned workflow tasks but it stays in your submissions and content status is pending.
One thing to mention is the image/document which is linked is already in publish state.
Is it a bug or a feature needs to be implemented?
Posted on 7/25/11 6:09 AM.
Thanks Juan for sharing this..

I want to implement exact same scenario for "User" asset. Meaning when new user is created, it should be assigned to some Work-flow definition e.g. single-approver definition. Then when it is approved by approver then only status may be changed to "Approved".

The problem I am facing is I don't know what would be the best approach for this. For just POC purpose, I changed the following files of Portal source code directly.

1. service.xml to add columns & reference package path for Work-flow
2. liferay-portlet.xml to add UserWorkflowHandler

Now the problem is after changing this service.xml, portal does not allow me to build services again saying that "Could not find com.liferay.portal.tools.servicebuilder.ServiceBuilder. Make sure you have it in your classpath", though ServiceBuilder class is available under the same package.

What can be root cause here?

Also can you also suggest some other better way for above kind of requirement when Liferay's OOB asset needs to be customized to apply Workflow on it?

Thanks in advance,
Jay.
Posted on 12/2/11 2:24 PM.
[...] 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... [...] Read More
Posted on 1/11/12 7:31 AM.
Hi Juan Fernández,

You have given very nice explanation in this tutorial. I have implemented this in one of my app. But i need to do some changes in this..As we submit it, the next person has to do "Assign to Me". And then he/she can approve or reject. But i did it in some other way. What I have done is, I am having 3 user A, B & C. A publish the content and assign it to B and then B after completing the work Route it to C. So the Approve & Reject right is only with A. I am successfully done with all this. But at all phase the user has to do "Assign to Me"; I don't want this button every time. As A route task to B and B route to C then why B & C require to click on "Assign to Me" each and every time? Can't we remove this? Please kindly provide me suggestion in this.....
Posted on 2/26/12 10:19 PM.
One more thing which i would like to know in the workflow is that can we bypass the flow? Means If 3user A, B and C are there and User A want to assign the task to C instead to B? How can you bypass the flow at runtime? Please kindly help me....
Posted on 2/28/12 10:47 PM.
Posted on 3/7/12 4:25 AM in reply to Keyur Ashra.
Hi Juan!
Im using Lifray 6.1 CE GA1 source and MySQL 5.1,tomcat 7.0.23 to build my portal.It works finally.Im trying to install kaleo-web-6.0.6.1.war,kaleo-web-6.1.0.1-ce-ga1.war in Control Panel/Plugins Installation but its not working and throws exception when deploying war file.Please help me emoticon
Posted on 6/5/12 9:20 PM in reply to Serdar Ayalp.
Hi Hung: why do you installed the old version of the plugin (6.0.6)?
You should remove it from your server and deploy the 6.1.0.1 version.
In case it fails, you can put your .war file into the "deploy" folder in tomcat and it will be automatically installed
Regards!
Posted on 6/5/12 11:25 PM in reply to Hung Dx.
Hi Juan!
Im trying to find kaleo-web version 6.1 war file on liferay download site but it does not exist.It only avalaible in sourceforge plugin link http://sourceforge.net/projects/lportal/files/Liferay%20Plugins/6.1.0%20GA1/ but can not deploy it on my server.
Thanks and Regards! emoticon
Posted on 6/6/12 8:01 PM in reply to Juan Fernández.
are you familiar with Liferay workflow definition? I want to assign a task by user email ID, so I can do it like the following, but XXX@XXX.com should be an input on UI page and then pass it to the workflow, how can I use a variable instead of XXX@XXX.com.

<task>
<name>Manager Approval</name>
<assignments>
<user>
<email-address>XXX@XXX.com</email-address>
</us­er>
</assignments>
<transitions>
<transition>
<name>Reject</name>
<target>update</tar­get>
<default>true</default>
</transition>
</transitions>
</task>
Posted on 8/2/12 3:08 AM.
Hi Kevin: have a look at this wiki page - http://www.liferay.com/community/wiki/-/wiki/Main/Workflow+Definition and this blog entry - http://www.liferay.com/es/web/igor.beslic/blog/-/blogs/12409698
I hope it helps
Juan
Posted on 8/2/12 3:10 AM in reply to kevin wu.
Hi,
I am using Liferay 6.0 with kaleo-web.
Now when i added te webcontent it is trying to send a mail notification to the people who are having Administrator Role.
Can we disbale/stop this feature of sending a mail notifications without uninstalling kaleo-web plugin.

Please help me .

Thanks in advance
Ram
Posted on 2/22/13 1:07 AM.
Hi
I want to use this functionality for my custom portlet. How can i link my custom portlet with this function? How will i get the Submit for Publication button and its function in my custom portlet???
Posted on 9/29/13 11:44 PM.
Hi
I want to use this functionality for my custom portlet. How can i link my custom portlet with this function? How will i get the Submit for Publication button and its function in my custom portlet???
Posted on 9/29/13 11:44 PM.
Hi
I want to use this functionality for my custom portlet. How can i link my custom portlet with this function? How will i get the Submit for Publication button and its function in my custom portlet???
Posted on 9/29/13 11:44 PM.
Hi
I want to use this functionality for my custom portlet. How can i link my custom portlet with this function? How will i get the Submit for Publication button and its function in my custom portlet???
Posted on 9/29/13 11:44 PM.
Hi
I want to use this functionality for my custom portlet. How can i link my custom portlet with this function? How will i get the Submit for Publication button and its function in my custom portlet???
Posted on 9/29/13 11:44 PM.
Hi
I want to use this functionality for my custom portlet. How can i link my custom portlet with this function? How will i get the Submit for Publication button and its function in my custom portlet???
Posted on 9/29/13 11:44 PM.
Hi
I want to use this functionality for my custom portlet. How can i link my custom portlet with this function? How will i get the Submit for Publication button and its function in my custom portlet???
Posted on 9/29/13 11:44 PM.
Hi
I want to use this functionality for my custom portlet. How can i link my custom portlet with this function? How will i get the Submit for Publication button and its function in my custom portlet???
Posted on 9/29/13 11:45 PM.
Hi
I want to use this functionality for my custom portlet. How can i link my custom portlet with this function? How will i get the Submit for Publication button and its function in my custom portlet???
Posted on 9/29/13 11:45 PM.
Hi
I want to use this functionality for my custom portlet. How can i link my custom portlet with this function? How will i get the Submit for Publication button and its function in my custom portlet???
Posted on 9/29/13 11:45 PM.
Hi
I want to use this functionality for my custom portlet. How can i link my custom portlet with this function? How will i get the Submit for Publication button and its function in my custom portlet???
Posted on 9/29/13 11:45 PM.
Hi Juan ,
Please support me to apply kaleo workflow for New Announcements .
Posted on 10/20/13 9:47 PM.
Hi Instead of going to 'my workflow tasks', can I have a set of buttons in my custom portlet screen and trigger the workflow actions like approve/reject ??
Posted on 4/18/14 5:34 AM.