Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: a longer workflow than single-approver workflow
hi, guys.
i want to create a longer workflow than single-approver workflow. In other words, i want to have a second level of review before an item is approved, it means that i’d create a new task in between the review task and the approved state. And who can provide me this longer workflow definition XML file ?
thanks in advance!
i want to create a longer workflow than single-approver workflow. In other words, i want to have a second level of review before an item is approved, it means that i’d create a new task in between the review task and the approved state. And who can provide me this longer workflow definition XML file ?
thanks in advance!
Here you have another one (for 6.2.0):
https://github.com/liferay/liferay-plugins/blob/6.2.0-ga1/webs/kaleo-web/docroot/WEB-INF/src/META-INF/definitions/legal-marketing-definition.xml
https://github.com/liferay/liferay-plugins/blob/6.2.0-ga1/webs/kaleo-web/docroot/WEB-INF/src/META-INF/definitions/legal-marketing-definition.xml
from where it can understand returnValue variable when using in condition. In mine it is throwing exception in groovy script
Thanks Its work for me.
Below is example.
<?xml version="1.0"?>
<workflow-definition
xmlns="urn:liferay.com:liferay-workflow_6.2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:liferay.com:liferay-workflow_6.2.0 http://www.liferay.com/dtd/liferay-workflow-definition_6_2_0.xsd"
>
<name>Legal and Marketing Approval</name>
<description>Workflow assets must be approved first by Marketing and then by Legal.</description>
<version>1</version>
<state>
<name>created</name>
<metadata>
<![CDATA[{"transitions":{"Market Review":{"xy":[-46,-12]}},"xy":[62,51]}]]>
</metadata>
<initial>true</initial>
<transitions>
<transition>
<name>Market Review</name>
<target>marketing-review</target>
<default>true</default>
</transition>
</transitions>
</state>
<task>
<name>update</name>
<metadata>
<![CDATA[{"transitions":{"Resubmit":{"bendpoints":[[427,40]],"xy":[-27,11]}},"xy":[530,36]}]]>
</metadata>
<actions>
<notification>
<name>Creator Modification Notification</name>
<template>Your asset was rejected by a reviewer, please modify and resubmit.</template>
<template-language>text</template-language>
<notification-type>email</notification-type>
<notification-type>user-notification</notification-type>
<execution-type>onAssignment</execution-type>
</notification>
</actions>
<assignments>
<user />
</assignments>
<transitions>
<transition>
<name>Resubmit</name>
<target>marketing-review</target>
<default>true</default>
</transition>
</transitions>
</task>
<task>
<name>marketing-review</name>
<metadata>
<![CDATA[{"transitions":{"Marketing Approved":{"xy":[-1,-29]},"Marketing Denied":{"xy":[-34,-1]}},"xy":[260,36]}]]>
</metadata>
<actions>
<notification>
<name>Market Content Review Notification</name>
<template>You have a new asset waiting for your review in the workflow.</template>
<template-language>text</template-language>
<notification-type>email</notification-type>
<notification-type>user-notification</notification-type>
<execution-type>onAssignment</execution-type>
</notification>
</actions>
<assignments>
<roles>
<role>
<role-type>regular</role-type>
<name>approver1</name>
</role>
</roles>
</assignments>
<transitions>
<transition>
<name>Marketing Approved</name>
<target>legal-review</target>
<default>true</default>
</transition>
<transition>
<name>Marketing Denied</name>
<target>update</target>
<default>false</default>
</transition>
</transitions>
</task>
<task>
<name>legal-review</name>
<metadata>
<![CDATA[{"xy":[260,270]}]]>
</metadata>
<actions>
<notification>
<name>Legal Content Review Notification</name>
<template>You have a new asset waiting for your review in the workflow.</template>
<template-language>text</template-language>
<notification-type>email</notification-type>
<notification-type>user-notification</notification-type>
<execution-type>onAssignment</execution-type>
</notification>
</actions>
<assignments>
<roles>
<role>
<role-type>regular</role-type>
<name>approver2</name>
</role>
</roles>
</assignments>
<transitions>
<transition>
<name>Legal Approval</name>
<target>approved</target>
<default>true</default>
</transition>
<transition>
<name>Legal Denied</name>
<target>update</target>
<default>false</default>
</transition>
</transitions>
</task>
<state>
<name>approved</name>
<metadata>
<![CDATA[
{"xy":[540,285]}
]]>
</metadata>
<actions>
<action>
<name>approve</name>
<script>
<![CDATA[
import com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil;
import com.liferay.portal.kernel.workflow.WorkflowConstants;
WorkflowStatusManagerUtil.updateStatus(WorkflowConstants.toStatus("approved"), workflowContext);
]]>
</script>
<script-language>groovy</script-language>
<execution-type>onEntry</execution-type>
</action>
</actions>
</state>
</workflow-definition>
<?xml version="1.0"?>
<workflow-definition
xmlns="urn:liferay.com:liferay-workflow_6.2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:liferay.com:liferay-workflow_6.2.0 http://www.liferay.com/dtd/liferay-workflow-definition_6_2_0.xsd"
>
<name>Legal and Marketing Approval</name>
<description>Workflow assets must be approved first by Marketing and then by Legal.</description>
<version>1</version>
<state>
<name>created</name>
<metadata>
<![CDATA[{"transitions":{"Market Review":{"xy":[-46,-12]}},"xy":[62,51]}]]>
</metadata>
<initial>true</initial>
<transitions>
<transition>
<name>Market Review</name>
<target>marketing-review</target>
<default>true</default>
</transition>
</transitions>
</state>
<task>
<name>update</name>
<metadata>
<![CDATA[{"transitions":{"Resubmit":{"bendpoints":[[427,40]],"xy":[-27,11]}},"xy":[530,36]}]]>
</metadata>
<actions>
<notification>
<name>Creator Modification Notification</name>
<template>Your asset was rejected by a reviewer, please modify and resubmit.</template>
<template-language>text</template-language>
<notification-type>email</notification-type>
<notification-type>user-notification</notification-type>
<execution-type>onAssignment</execution-type>
</notification>
</actions>
<assignments>
<user />
</assignments>
<transitions>
<transition>
<name>Resubmit</name>
<target>marketing-review</target>
<default>true</default>
</transition>
</transitions>
</task>
<task>
<name>marketing-review</name>
<metadata>
<![CDATA[{"transitions":{"Marketing Approved":{"xy":[-1,-29]},"Marketing Denied":{"xy":[-34,-1]}},"xy":[260,36]}]]>
</metadata>
<actions>
<notification>
<name>Market Content Review Notification</name>
<template>You have a new asset waiting for your review in the workflow.</template>
<template-language>text</template-language>
<notification-type>email</notification-type>
<notification-type>user-notification</notification-type>
<execution-type>onAssignment</execution-type>
</notification>
</actions>
<assignments>
<roles>
<role>
<role-type>regular</role-type>
<name>approver1</name>
</role>
</roles>
</assignments>
<transitions>
<transition>
<name>Marketing Approved</name>
<target>legal-review</target>
<default>true</default>
</transition>
<transition>
<name>Marketing Denied</name>
<target>update</target>
<default>false</default>
</transition>
</transitions>
</task>
<task>
<name>legal-review</name>
<metadata>
<![CDATA[{"xy":[260,270]}]]>
</metadata>
<actions>
<notification>
<name>Legal Content Review Notification</name>
<template>You have a new asset waiting for your review in the workflow.</template>
<template-language>text</template-language>
<notification-type>email</notification-type>
<notification-type>user-notification</notification-type>
<execution-type>onAssignment</execution-type>
</notification>
</actions>
<assignments>
<roles>
<role>
<role-type>regular</role-type>
<name>approver2</name>
</role>
</roles>
</assignments>
<transitions>
<transition>
<name>Legal Approval</name>
<target>approved</target>
<default>true</default>
</transition>
<transition>
<name>Legal Denied</name>
<target>update</target>
<default>false</default>
</transition>
</transitions>
</task>
<state>
<name>approved</name>
<metadata>
<![CDATA[
{"xy":[540,285]}
]]>
</metadata>
<actions>
<action>
<name>approve</name>
<script>
<![CDATA[
import com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil;
import com.liferay.portal.kernel.workflow.WorkflowConstants;
WorkflowStatusManagerUtil.updateStatus(WorkflowConstants.toStatus("approved"), workflowContext);
]]>
</script>
<script-language>groovy</script-language>
<execution-type>onEntry</execution-type>
</action>
</actions>
</state>
</workflow-definition>
Hi Tushar Patel,
Regarding two level approval workflow, I have used your code in liferay 7.2 CE. Approvals has been done, But the content is not published. Still its showing pending status. In console I am getting the below error. Did I missed anything ?
Caused by: com.liferay.portal.kernel.scripting.ScriptingException:No signature of method: static com.liferay.portal.kernel.workflow.WorkflowConstants.toStatus()is applicable for argument
types: (java.lang.String) values:[approved]_Possible solutions: toString(), toString()_Line 1: _Line 2: _Line 3:import com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil;_Line 4: import com.liferay.portal.kernel.workflow.WorkflowConstants;
Regarding two level approval workflow, I have used your code in liferay 7.2 CE. Approvals has been done, But the content is not published. Still its showing pending status. In console I am getting the below error. Did I missed anything ?
Caused by: com.liferay.portal.kernel.scripting.ScriptingException:No signature of method: static com.liferay.portal.kernel.workflow.WorkflowConstants.toStatus()is applicable for argument
types: (java.lang.String) values:[approved]_Possible solutions: toString(), toString()_Line 1: _Line 2: _Line 3:import com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil;_Line 4: import com.liferay.portal.kernel.workflow.WorkflowConstants;
It seems, the interface changed and the toStatus method was removed.
https://docs.liferay.com/ce/portal/7.2-latest/javadocs/portal-kernel/com/liferay/portal/kernel/workflow/WorkflowConstants.html
I would try:
WorkflowStatusManagerUtil.updateStatus(WorkflowConstants.STATUS_APPROVED, workflowContext);
https://docs.liferay.com/ce/portal/7.2-latest/javadocs/portal-kernel/com/liferay/portal/kernel/workflow/WorkflowConstants.html
I would try:
WorkflowStatusManagerUtil.updateStatus(WorkflowConstants.STATUS_APPROVED, workflowContext);
Please check following link for the same I have attached one sample file of two level approval of kaleo OOTB workflow.
https://www.liferay.com/community/forums/-/message_boards/message/42917043
https://www.liferay.com/community/forums/-/message_boards/message/42917043
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™