【发布时间】:2015-08-07 09:00:31
【问题描述】:
我在 Liferay 6.2 中实现了一个简单的单一批准 Kaleo 工作流程。
我的要求是在资产获得批准后向创建资产的用户发送通知。
“您的请求已获批准”通知未发送给创建资产的用户。下面是我的工作流 XML。
<?xml version="1.0" encoding="UTF-8"?>
<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>Test</name>
<version>1</version>
<state>
<name>Created</name>
<metadata><![CDATA[{"transitions":{"to_pending":{"bendpoints":[],"xy":[-26,-20]},"sent":{"bendpoints":[]},"ToPending":{"bendpoints":[],"xy":[-26,-20]},"CreatorCheck":{"bendpoints":[],"xy":[-36,10]}},"xy":[63,82]}]]></metadata>
<initial>true</initial>
<transitions>
<transition>
<name>ToPending</name>
<target>PendingTask</target>
</transition>
</transitions>
</state>
<task>
<name>PendingTask</name>
<metadata><![CDATA[{"transitions":{"Approved":{"bendpoints":[],"xy":[-36,10]},"Rejected":{"bendpoints":[]}},"xy":[220,70]}]]></metadata>
<actions>
<notification>
<name>NotifyEveryone</name>
<template>Task is in pending state.</template>
<template-language>velocity</template-language>
<notification-type>user-notification</notification-type>
<execution-type>onEntry</execution-type>
</notification>
<notification>
<name>RejectedNotification</name>
<template>Your Request has been rejected!</template>
<template-language>velocity</template-language>
<notification-type>user-notification</notification-type>
<recipients>
<user />
</recipients>
<execution-type>onExit</execution-type>
</notification>
<notification>
<name>ApprovedNotification</name>
<template>Your Request has been Approved!</template>
<template-language>velocity</template-language>
<notification-type>user-notification</notification-type>
<recipients>
<user />
</recipients>
<execution-type>onExit</execution-type>
</notification>
</actions>
<assignments>
<roles>
<role>
<role-type>regular</role-type>
<name>Portal Content Reviewer</name>
<auto-create>true</auto-create>
</role>
</roles>
</assignments>
<transitions>
<transition>
<name>Approved</name>
<target>Approved</target>
</transition>
<transition>
<name>Rejected</name>
<target>Rejected</target>
</transition>
</transitions>
</task>
<state>
<name>Approved</name>
<metadata><![CDATA[{"terminal":true,"xy":[413,52]}]]></metadata>
<actions>
<action>
<name>Approved</name>
<script>
<![CDATA[
import com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil
import com.liferay.portal.kernel.workflow.WorkflowConstants
WorkflowStatusManagerUtil.updateStatus(WorkflowConstants.STATUS_APPROVED, workflowContext)
]]>
</script>
<script-language>groovy</script-language>
<execution-type>onEntry</execution-type>
</action>
<notification>
<name>newNotification1</name>
<template>Your Request has been Approved</template>
<template-language>text</template-language>
<notification-type>user-notification</notification-type>
<execution-type>onEntry</execution-type>
</notification>
</actions>
</state>
<state>
<name>Rejected</name>
<metadata><![CDATA[{"terminal":true,"xy":[413,144]}]]></metadata>
<actions>
<action>
<name>Rejected</name>
<script>
<![CDATA[
import com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil
import com.liferay.portal.kernel.workflow.WorkflowConstants
WorkflowStatusManagerUtil.updateStatus(WorkflowConstants.STATUS_DENIED, workflowContext)
]]></script>
<script-language>groovy</script-language>
<execution-type>onEntry</execution-type>
</action>
</actions>
</state>
</workflow-definition>
我确实检查了以下链接
在第二个链接中,Vishal 已指定
我们可以在
如果是这种情况,我该如何实现我的要求?我可以添加另一个发送通知然后调用“批准”状态的任务吗?
编辑 根据需要添加了“拒绝”状态。还为 Saleem Khan 和 Jozef Chocholacek
指出的创建请求的用户添加了已批准和已拒绝的通知消息现在,无论资产是“批准”还是“拒绝”,都会发送通知。在“拒绝”上,必须发送不同的消息。如何检查资产是被批准还是被拒绝并发送不同的消息?
【问题讨论】:
标签: liferay workflow liferay-6