When starting a workflow, there is an checkbox for sending a email notification. We would like to customize that email with our own email-template. How do we that without changing the default template?
There are two files which are responsible for sending the email notification in alfresco.
You need to extend above two files.
TaskNotificationListener is having one function named as notify, that is the function in which you need to add all the custom variables/properties which you want to use in ftl template.So for example if you would like to add some custom property named as inv:invoice_number in the email then you can fetch it in this files and add it in variable.Finally inside this function it is calling a method which is in WorkflowNotificationUtils.
WorkflowNotificationUtils contains many function, you can create one of yours and call that from your notify function which is in TaskNotificationListener.WorkflowNotificationUtils also defines the template , so you can change that as well.
For extending above two files , you need to create beans as per below in service-context.xml
<bean id="customWorkflowNotification" class="com.alfresco.repo.workflow.CustomWorkflowNotificationUtils"> <property name="workflowService" ref="workflowServiceImpl"/> <property name="nodeService" ref="NodeService"/> <property name="notificationService" ref="NotificationService"/> </bean> <bean id="activitiTaskNotificationListener" class="com.alfresco.repo.workflow.activiti.tasklistener.CustomTaskNotificationListener" depends-on="activitiWorkflowManager"> <property name="propertyConverter" ref="activitiPropertyConverter" /> <property name="workflowNotification" ref="customWorkflowNotification" /> <property name="nodeService" ref="NodeService"/> <property ref="PersonService" name="personService" /> <property ref="AuthenticationService" name="authenticationService" /> </bean>
Retrieving data ...