Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Michael Woolfall
Decision in Workflow
October 8, 2012 9:56 PM
Answer

Michael Woolfall

Rank: New Member

Posts: 6

Join Date: September 23, 2012

Recent Posts

Liferay 6.1
Kaleo Workflow

My Question relates to writing the xml for a workflow.

The workflow is at a certain role and a decision needs to be made.

For example, if something is true... do something, otherwise... do something else.

I thought maybe a fork could be used however this would mean that both pathways would have to be executed. I want the user to be able to select a single pathway they go down i.e., "Yes" or "No". One of the decisions will retain the workflow with the current user and ask a secondary question.

Is there a simple way of doing this e.g. by manipulating a fork?

Would rather keep it within the xml than anything more complex.

Thanks, Michael.
Vishal Panchal
RE: Decision in Workflow
October 8, 2012 10:13 PM
Answer

Vishal Panchal

Rank: Expert

Posts: 279

Join Date: May 20, 2012

Recent Posts

Michael Woolfall:
Liferay 6.1
Kaleo Workflow

My Question relates to writing the xml for a workflow.

The workflow is at a certain role and a decision needs to be made.

For example, if something is true... do something, otherwise... do something else.

I thought maybe a fork could be used however this would mean that both pathways would have to be executed. I want the user to be able to select a single pathway they go down i.e., "Yes" or "No". One of the decisions will retain the workflow with the current user and ask a secondary question.

Is there a simple way of doing this e.g. by manipulating a fork?

Would rather keep it within the xml than anything more complex.

Thanks, Michael.


Hi Michael,
By reading your post I understood that you want something conditional thing in workflow.
You can do this by simply adding some condition and added condition will be checked @ Approval/Rejection time by a particular role/user.
Now is question is what about SOMETHING in below line you wrote.
For example, if something is true... do something, otherwise... do something else.


So you want this value from your class or as an user Input ..than you want to execute your condition in workflow definition?
Or other way you can execute the condition on basis of Approval/Rejection.

For condition example see this link..


Best Regards,
Vishal R. Panchal
Michael Woolfall
RE: Decision in Workflow
October 14, 2012 7:08 PM
Answer

Michael Woolfall

Rank: New Member

Posts: 6

Join Date: September 23, 2012

Recent Posts

Thank you Vishal. I did not know about the condition tag.
Christoph Rabel
RE: Decision in Workflow
October 17, 2012 2:06 AM
Answer

Christoph Rabel

Rank: Regular Member

Posts: 156

Join Date: September 24, 2009

Recent Posts

I just posted this code in another thread, maybe it helps you too:
 1        <condition>
 2        <name>review-or-approve</name>
 3        <script>
 4            <![CDATA[
 5                import com.liferay.portal.service.RoleLocalServiceUtil;
 6                import com.liferay.portal.kernel.util.GetterUtil;
 7                import com.liferay.portal.kernel.workflow.WorkflowConstants;
 8
 9                try {
10                    returnValue = "Review";
11                    long userid = GetterUtil.getLong((String)workflowContext.get(WorkflowConstants.CONTEXT_USER_ID));
12                    long companyid = GetterUtil.getLong((String)workflowContext.get(WorkflowConstants.CONTEXT_COMPANY_ID));
13                    String[] roles={"Publisher","Administrator"};
14                    if (RoleLocalServiceUtil.hasUserRoles(userid, companyid, roles, true)) returnValue = "Approved";
15                } catch (Exception e) {
16                  e.printStackTrace();
17                }
18            ]]>
19        </script>
20        <script-language>beanshell</script-language>
21        <transitions>
22            <transition>
23                <name>Review</name>
24                <target>review</target>
25                <default>false</default>
26            </transition>
27            <transition>
28                <name>Approved</name>
29                <target>approved</target>
30                <default>false</default>
31            </transition>
32        </transitions>
33    </condition>


If user has publisher or admin role, go to approved, otherwise go to review.
vivek rathore
RE: Decision in Workflow
April 3, 2014 9:22 AM
Answer

vivek rathore

Rank: New Member

Posts: 11

Join Date: November 6, 2013

Recent Posts

but in my workflow it is throwing exception for returnValue not a variable defined