如何在工作流上下文中访问 Liferay 变量值
How to access Liferay Variable value in Workflow context
我在 liferay 6.2 中创建了一个内容批准器工作流程。我想在电子邮件主题的模板标签中显示用户名和其他变量值。
我已经添加了描述标签来显示电子邮件主题,但是当我尝试在其中使用变量时,它会将变量显示为字符串而不是它的值。
下面是我的模板
<actions>
<notification>
<name>Review Notification</name>
<description><![CDATA[${userName}]]> test sent you a <![CDATA[${entryType}]]> for review in the workflow.</description>
<template>${userName} sent you a ${entryType} for review in the workflow.</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>
<description>Your submission has been reviewed and the reviewer has applied the following ${taskComments}.</description>
<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>
在描述标签中我使用了变量 ${username} 和 ${entryType} 而是显示
"Test sent you a Web Content Article for review in the workflow."
它正在显示:
“${userName} 向您发送了一个 ${entryType} 供您在工作流程中查看。”
但在电子邮件正文中显示正常。任何帮助
不幸的是,假设您没有对原始 Liferay 源进行任何修改,您无法将任何变量传递到此部分。
String notificationMessage = notificationMessageGenerator.generateMessage(kaleoNotification.getKaleoClassName(), kaleoNotification.getKaleoClassPK(), kaleoNotification.getName(), kaleoNotification.getTemplateLanguage(), kaleoNotification.getTemplate(), executionContext);
String notificationSubject = kaleoNotification.getDescription();
上面的这些行负责消息的创建。如您所见,notificationMessage 是使用 executionContext 和其他一些参数创建的,这些参数存储上下文变量,最后用实际值替换您的令牌变量。描述只是向前传递的简单字符串,因此在这种情况下没有进行此类替换。
我在 liferay 6.2 中创建了一个内容批准器工作流程。我想在电子邮件主题的模板标签中显示用户名和其他变量值。
我已经添加了描述标签来显示电子邮件主题,但是当我尝试在其中使用变量时,它会将变量显示为字符串而不是它的值。
下面是我的模板
<actions>
<notification>
<name>Review Notification</name>
<description><![CDATA[${userName}]]> test sent you a <![CDATA[${entryType}]]> for review in the workflow.</description>
<template>${userName} sent you a ${entryType} for review in the workflow.</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>
<description>Your submission has been reviewed and the reviewer has applied the following ${taskComments}.</description>
<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>
在描述标签中我使用了变量 ${username} 和 ${entryType} 而是显示
"Test sent you a Web Content Article for review in the workflow."
它正在显示: “${userName} 向您发送了一个 ${entryType} 供您在工作流程中查看。”
但在电子邮件正文中显示正常。任何帮助
不幸的是,假设您没有对原始 Liferay 源进行任何修改,您无法将任何变量传递到此部分。
String notificationMessage = notificationMessageGenerator.generateMessage(kaleoNotification.getKaleoClassName(), kaleoNotification.getKaleoClassPK(), kaleoNotification.getName(), kaleoNotification.getTemplateLanguage(), kaleoNotification.getTemplate(), executionContext);
String notificationSubject = kaleoNotification.getDescription();
上面的这些行负责消息的创建。如您所见,notificationMessage 是使用 executionContext 和其他一些参数创建的,这些参数存储上下文变量,最后用实际值替换您的令牌变量。描述只是向前传递的简单字符串,因此在这种情况下没有进行此类替换。