Alfresco - add recipient's name to workflow notification email template

时光毁灭记忆、已成空白 提交于 2020-07-10 10:28:13

问题


I'm using Alfresco 5.2 Community. I'm trying to edit the template wf-email.html.ftl file found in Repository> Data Dictionary> Email Templates> Workflow Notification> wf-email.html.ftl.

In the line

<p>Hi,</p>

I want to add the recipient's name in the message, something like

<p>Hi John,</p>

Is this possible? If yes, how is it achieved?


回答1:


Unfortunately, the assignee is not passed as an argument to the template, so it is not available to the template. You can see this by looking at the source of the class that actually sends the notification:

https://github.com/Alfresco/alfresco-repository/blob/master/src/main/java/org/alfresco/repo/workflow/WorkflowNotificationUtils.java

Looking at that class you can see where things like the workflow ID, title, and description are added as arguments that get passed to the template renderer:

    templateArgs.put(ARG_WF_ID, taskId);
    templateArgs.put(ARG_WF_TITLE, taskTitle);
    templateArgs.put(ARG_WF_DESCRIPTION, description);

But the assignee is not passed.

You could lookup the workflow and then get the current task and then get the assignee to that task, but that's probably not the best way to go about it.

If you really need this, I would extend the existing WorkflowNotificationUtils.java with my own, and add in the assignee as an argument to the template. Or I'd turn off the default notifications and just use my own notification classes that my custom workflows call.



来源:https://stackoverflow.com/questions/62528492/alfresco-add-recipients-name-to-workflow-notification-email-template

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!