AnsweredAssumed Answered

Workflow Javascript Mail Fail

Question asked by nunuts on May 2, 2012
Latest reply on Jun 27, 2012 by checco
Hi all,
I'm trying to send mail by javascript within workflow. My reference is . This is my code :
<?xml version="1.0" encoding="UTF-8"?>

<process-definition xmlns="" name="wf:review">

    <swimlane name="initiator" />

    <start-state name="start">
        <task name="wf:submitReviewTask" swimlane="initiator" />
        <transition name="" to="review" />

    <swimlane name="reviewer">
        <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">

    <task-node name="review">
        <task name="wf:reviewTask" swimlane="reviewer">
            <event type="task-create">
                    if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
                    if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority;
         <event type="task-assign">
          <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                 var doc1 = userhome.createFile("transform_me1.txt");
                 doc1.mimetype = "text/plain";
                 doc1.content = "This is plain text";
                  var mail = actions.create("mail");
         = "";
                  mail.parameters.subject = "New Alfresco workflow submission: ";
                  mail.parameters.from = "";
                                           mail.parameters.template = root.childByNamePath("Company Home/Data Dictionary/Email Templates/notify_user_email.ftl");
                  mail.parameters.text = "some text, in case template is not found";           
        <transition name="approve" to="approved" />
        <transition name="reject" to="rejected" />

    <task-node name="rejected">
        <task name="wf:rejectedTask" swimlane="initiator" />
        <transition name="" to="end" />

    <task-node name="approved">
        <task name="wf:approvedTask" swimlane="initiator" />
        <transition name="" to="end" />

    <end-state name="end" />

But when I run this code, my workflow is fail. I think the problem is this :
mail.parameters.template = root.childByNamePath("Company Home/Data Dictionary/Email Templates/notify_user_email.ftl");
cause when I remove this line, the workflow works perfectly. Can anyone help me with this?