cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the current task id in email notification templat

yteng
Champ in-the-making
Champ in-the-making
Hey guys,
     Is there any way to get the task id of the workflow instance in which the notifying emails generated from in notification email template? Then I can list the relevant workflow instance information in the email template.

   Here, I found

<event type="task-create">
    <script>
        if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
        if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority;
   </script>
</event>

I dont know how to get taskInstance in my notification email template? There is a sample in wiki using assignedTasks method to get all workflow instances, but what I need is the instance associated within the email.

Here is the email sending part in the workflow definition :


<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
    <script>
      if (ncm_notifyByStep)
      { 
   var mail = actions.create("mail");
   mail.parameters.to = initiator.properties["cm:email"];
   mail.parameters.subject = "Adhoc Task " + bpm_workflowDescription;
   mail.parameters.from = "xxx@myserver.com";
   mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/Notify Email Templates/notify_user.ftl");
   mail.parameters.text="in case, no tempates found … "
   mail.execute(bpm_package);                       
     }
  </script>
</action>


I tried ${taskInstance} in notify_user.ftl, only got the error: taskInstance is not defined ….

Thanks in advance!
2 REPLIES 2

stevegreenbaum
Champ in-the-making
Champ in-the-making

sans
Champ in-the-making
Champ in-the-making
Hi yteng,
Did you find the solution to get the taskid in email template?

Please help!!
Thanks