cancel
Showing results for 
Search instead for 
Did you mean: 

Passing Liferay workflow objects to Activiti serviceTask

guru_nayak
Champ in-the-making
Champ in-the-making
We are integrating Liferay with Activiti Workflow along with Drools. We would like to pass the Liferay workflow context to the service task in Activiti workflow. Can anyone tell me the best way to do this.
We tried defining a script task

<scriptTask id="scriptTask" scriptFormat="LiferayJavaScript">
    <script>
          def var person = (Long) workflowContext.getSomething("aaa");
     </script>
</scriptTask>
Now the issue is this person object is not accessible outside in other workflow script tasks. How to access the person object.
If we define other scriptTasks with scriptFormat as "javascript" then it gives various errors or classnotfound or such related exceptions.
3 REPLIES 3

guru_nayak
Champ in-the-making
Champ in-the-making
After experimenting we realised that there is something called LiferayJavaScript format which the Activit "scriptTask" supports. Now the problem is that workflowcontext and other objects that belong to liferay are available in the LiferayJavaScript scriptTask scope
but if we wish to pass workflowcontext outside to other scriptTasks(non-LiferayJavaScript) in the same workflow then it either gives us classnotfound or other related exceptions. I think the crux of the issue is the main integration between liferay and activiti in this region needs some work.
LiferayJavaScript scriptTask does not understand the "execution" variable that is commonly uses in activiti workflows. This points to the gaping hole in the integration between these 2 frameworks…

We are facing serious issues in integrating liferay with Activiti and drools. Any help on this wud be appreciated. The simple workflow example that is available in the emforge liferay-activiti page is too simple to be used in real life.
Any example involving liferay, activiti and drools rule engine would have been wonderful.

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
We are facing serious issues in integrating liferay with Activiti and drools. Any help on this wud be appreciated. The simple workflow example that is available in the emforge liferay-activiti page is too simple to be used in real life.
Any example involving liferay, activiti and drools rule engine would have been wonderful.

I think you stand a better chance of getting help on this in the Liferay forum…

guru_nayak
Champ in-the-making
Champ in-the-making
We found the solution and Iam posting this for the benefit of others.
<scriptTask id="scriptTask" scriptFormat="groovy">
    <script>
        // import necessary liferay packages
        import com…..
        var product = productServiceLocalUtil.getProduct(execution.getVariable("serviceContext").getProductId);
    <script>
</scriptTask>

returns the serviceContext of liferay from where one can get all the other related liferay objects. We invoked this from a Activiti script task in inside a workflow.
This small piece of code proved to be the last missing link for us in integrating liferay with activiti and we found this by sheer luck. One more point to be noted is that the serviceContext is not set by us anywhere in our code instead it is getting internally set by Liferay-activiti plugin.

- Guru