Liferay:自定义 Kaleo 通知
Liferay: Custom Kaleo Notification
我正在为审阅者、管理员发送自定义通知,任何人都可以帮助我找出我的 kaleo 工作流程中的问题吗?
这是要求
- 出于安全目的,管理员可以为用户创建一个新帐户。
- 审核者(像管理员一样,但唯一的权限是审核、批准和拒绝管理员和用户的请求)所有创建新帐户的管理员都必须审核是否批准或不是由审阅者在从管理员
创建新帐户之前
流量:
- 管理员然后为新用户创建一个帐户
- 然后通知审阅者审阅管理员的请求
- 一个。如果审稿人拒绝申请请求,通知管理员重新提交更新。
- 乙。如果审阅者批准了申请请求,请通知管理员该请求已获批准。
- 完成
问题是 1 到 3 工作正常,但在审核者批准申请后的 4 中,管理员没有收到通知
这是我的代码
<?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>custom-mrcos-notify</name>
<version>1</version>
<state>
<name>created</name>
<metadata>
<![CDATA[{"transitions":{"review":{"bendpoints":[]}},"xy":[30,30]}]]>
</metadata>
<initial>true</initial>
<transitions>
<transition>
<name>review</name>
<target>review</target>
</transition>
</transitions>
</state>
<task>
<name>update</name>
<metadata>
<![CDATA[{"transitions":{"resubmit":{"bendpoints":[[303,140]]}},"xy":[260,220]}]]>
</metadata>
<actions>
<action>
<name>reject</name>
<script>
< ![CDATA[
Packages.com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil.updateStatus(Packages.com.liferay.portal.kernel.workflow.WorkflowConstants.toStatus("denied"), workflowContext);
Packages.com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil.updateStatus(Packages.com.liferay.portal.kernel.workflow.WorkflowConstants.toStatus("pending"), workflowContext);]] >
</script>
<script-language>javascript</script-language>
<execution-type>onAssignment</execution-type>
</action>
<notification>
<name>Creator Modification Notification</name>
<template>Your submission was rejected by ${userName}, please modify and resubmit.</template>
<template-language>freemarker</template-language>
<notification-type>email</notification-type>
<notification-type>user-notification</notification-type>
<execution-type>onAssignment</execution-type>
</notification>
</actions>
<assignments>
<user>
<email-address>r@liferay.com</email-address>
</user>
</assignments>
<transitions>
<transition>
<name>resubmit</name>
<target>review</target>
</transition>
</transitions>
</task>
<task>
<name>review</name>
<metadata>
<![CDATA[{"transitions":{"approve":{"bendpoints":[[354,82]]},"reject":{"bendpoints":[]}},"xy":[160,30]}]]>
</metadata>
<actions>
<notification>
<name>Review Notification</name>
<template>${userName} sent you a ${entryType} for review.</template>
<template-language>freemarker</template-language>
<notification-type>email</notification-type>
<notification-type>user-notification</notification-type>
<execution-type>onAssignment</execution-type>
</notification>
<notification>
<name>Review Completion Notification</name>
<template>Your submission has been reviewed and the reviewer has applied the following ${taskComments}.</template>
<template-language>freemarker</template-language>
<notification-type>email</notification-type>
<recipients>
<user />
</recipients>
<execution-type>onExit</execution-type>
</notification>
</actions>
<assignments>
<user>
<email-address>r@liferay.com</email-address>
</user>
</assignments>
<transitions>
<transition>
<name>reject</name>
<target>update</target>
<default>false</default>
</transition>
<transition>
<name>approve</name>
<target>Approved</target>
</transition>
</transitions>
</task>
<state>
<name>approved</name>
<metadata>
<![CDATA[{"xy":[740,100]}]]>
</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>
<task>
<name>Approved</name>
<metadata>
<![CDATA[{"transitions":{"Ok":{"bendpoints":[]},"ok":{"bendpoints":[]}},"xy":[470,30]}]]>
</metadata>
<actions>
<notification>
<name>notify-approved</name>
<template>The application of ${entryType} is approved by ${userName}.</template>
<template-language>freemarker</template-language>
<notification-type>email</notification-type>
<execution-type>onAssignment</execution-type>
</notification>
<action>
<name>approved</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>
<assignments>
<user>
<email-address>test@liferay.com</email-address>
</user>
</assignments>
<transitions>
<transition>
<name>Ok</name>
<target>approved</target>
</transition>
</transitions>
</task>
注意我上面给出的代码是针对 kaleo 工作流程的。
我会尝试更改执行类型:
<execution-type>onAssignment</execution-type>
至
<execution-type>onEntry</execution-type>
在任务的最后一部分已批准
以下文档:
Sending notifications
Notifications need an execution-type which can be onAssignment,
onEntry or onExit.
onAssignment generates and sends the notification when the user is assigned the task in the workflow. Note: onAssignment notification
will not work if you wish to notify a user that is not part of the
workflow.
onEntry generates and sends the notification when entering the workflow task or state.
onExit generates and sends the notification when exiting the workflow task or state.
我设法配置了单一审批者工作流以完全符合您的方案,该方案在文档获得批准时使用用户通知。我对默认工作流定义应用的一项更改是将部分通知添加到已批准状态。这是部分代码:
<state>
<name>approved</name>
<metadata>
<![CDATA[{"xy":[380,51]}]]>
</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>
<notification>
<name>Creator Approval Notification</name>
<template>Your submission was accepted by ${userName}.</template>
<template-language>freemarker</template-language>
<notification-type>user-notification</notification-type>
<recipients>
<user/>
</recipients>
<execution-type>onExit</execution-type>
</notification>
</actions>
</state>
将类似的通知部分添加到您的 approved 节点。另一方面,我不确定您是否真的需要另一个节点 Approved before approved 状态。
我正在为审阅者、管理员发送自定义通知,任何人都可以帮助我找出我的 kaleo 工作流程中的问题吗?
这是要求
- 出于安全目的,管理员可以为用户创建一个新帐户。
- 审核者(像管理员一样,但唯一的权限是审核、批准和拒绝管理员和用户的请求)所有创建新帐户的管理员都必须审核是否批准或不是由审阅者在从管理员 创建新帐户之前
流量:
- 管理员然后为新用户创建一个帐户
- 然后通知审阅者审阅管理员的请求
- 一个。如果审稿人拒绝申请请求,通知管理员重新提交更新。
- 乙。如果审阅者批准了申请请求,请通知管理员该请求已获批准。
- 完成
问题是 1 到 3 工作正常,但在审核者批准申请后的 4 中,管理员没有收到通知
这是我的代码
<?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>custom-mrcos-notify</name>
<version>1</version>
<state>
<name>created</name>
<metadata>
<![CDATA[{"transitions":{"review":{"bendpoints":[]}},"xy":[30,30]}]]>
</metadata>
<initial>true</initial>
<transitions>
<transition>
<name>review</name>
<target>review</target>
</transition>
</transitions>
</state>
<task>
<name>update</name>
<metadata>
<![CDATA[{"transitions":{"resubmit":{"bendpoints":[[303,140]]}},"xy":[260,220]}]]>
</metadata>
<actions>
<action>
<name>reject</name>
<script>
< ![CDATA[
Packages.com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil.updateStatus(Packages.com.liferay.portal.kernel.workflow.WorkflowConstants.toStatus("denied"), workflowContext);
Packages.com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil.updateStatus(Packages.com.liferay.portal.kernel.workflow.WorkflowConstants.toStatus("pending"), workflowContext);]] >
</script>
<script-language>javascript</script-language>
<execution-type>onAssignment</execution-type>
</action>
<notification>
<name>Creator Modification Notification</name>
<template>Your submission was rejected by ${userName}, please modify and resubmit.</template>
<template-language>freemarker</template-language>
<notification-type>email</notification-type>
<notification-type>user-notification</notification-type>
<execution-type>onAssignment</execution-type>
</notification>
</actions>
<assignments>
<user>
<email-address>r@liferay.com</email-address>
</user>
</assignments>
<transitions>
<transition>
<name>resubmit</name>
<target>review</target>
</transition>
</transitions>
</task>
<task>
<name>review</name>
<metadata>
<![CDATA[{"transitions":{"approve":{"bendpoints":[[354,82]]},"reject":{"bendpoints":[]}},"xy":[160,30]}]]>
</metadata>
<actions>
<notification>
<name>Review Notification</name>
<template>${userName} sent you a ${entryType} for review.</template>
<template-language>freemarker</template-language>
<notification-type>email</notification-type>
<notification-type>user-notification</notification-type>
<execution-type>onAssignment</execution-type>
</notification>
<notification>
<name>Review Completion Notification</name>
<template>Your submission has been reviewed and the reviewer has applied the following ${taskComments}.</template>
<template-language>freemarker</template-language>
<notification-type>email</notification-type>
<recipients>
<user />
</recipients>
<execution-type>onExit</execution-type>
</notification>
</actions>
<assignments>
<user>
<email-address>r@liferay.com</email-address>
</user>
</assignments>
<transitions>
<transition>
<name>reject</name>
<target>update</target>
<default>false</default>
</transition>
<transition>
<name>approve</name>
<target>Approved</target>
</transition>
</transitions>
</task>
<state>
<name>approved</name>
<metadata>
<![CDATA[{"xy":[740,100]}]]>
</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>
<task>
<name>Approved</name>
<metadata>
<![CDATA[{"transitions":{"Ok":{"bendpoints":[]},"ok":{"bendpoints":[]}},"xy":[470,30]}]]>
</metadata>
<actions>
<notification>
<name>notify-approved</name>
<template>The application of ${entryType} is approved by ${userName}.</template>
<template-language>freemarker</template-language>
<notification-type>email</notification-type>
<execution-type>onAssignment</execution-type>
</notification>
<action>
<name>approved</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>
<assignments>
<user>
<email-address>test@liferay.com</email-address>
</user>
</assignments>
<transitions>
<transition>
<name>Ok</name>
<target>approved</target>
</transition>
</transitions>
</task>
注意我上面给出的代码是针对 kaleo 工作流程的。
我会尝试更改执行类型:
<execution-type>onAssignment</execution-type>
至
<execution-type>onEntry</execution-type>
在任务的最后一部分已批准
以下文档:
Sending notifications Notifications need an execution-type which can be onAssignment, onEntry or onExit.
onAssignment generates and sends the notification when the user is assigned the task in the workflow. Note: onAssignment notification
will not work if you wish to notify a user that is not part of the
workflow.onEntry generates and sends the notification when entering the workflow task or state.
onExit generates and sends the notification when exiting the workflow task or state.
我设法配置了单一审批者工作流以完全符合您的方案,该方案在文档获得批准时使用用户通知。我对默认工作流定义应用的一项更改是将部分通知添加到已批准状态。这是部分代码:
<state>
<name>approved</name>
<metadata>
<![CDATA[{"xy":[380,51]}]]>
</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>
<notification>
<name>Creator Approval Notification</name>
<template>Your submission was accepted by ${userName}.</template>
<template-language>freemarker</template-language>
<notification-type>user-notification</notification-type>
<recipients>
<user/>
</recipients>
<execution-type>onExit</execution-type>
</notification>
</actions>
</state>
将类似的通知部分添加到您的 approved 节点。另一方面,我不确定您是否真的需要另一个节点 Approved before approved 状态。