Liferay Workflow In Action

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

Blogs
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!
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
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
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
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.
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.
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
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
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
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 ?
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.
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>
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.
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?
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.
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.....
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....
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
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!
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
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>
</user>
</assignments>
<transitions>
<transition>
<name>Reject</name>
<target>update</target>
<default>true</default>
</transition>
</transitions>
</task>
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
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
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???
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???
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???
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???
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???
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???
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???
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???
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???
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???
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???