AnsweredAssumed Answered

Error : ReferenceError: 'companyhome' is not defined.

Question asked by nitinkcv on Nov 3, 2009
Latest reply on May 24, 2011 by sans

I'm actually trying to trigger a mail using the AlfrescoJavascript.

Part of my code in the process definition file is:

<transition name="moreInfoNeeded" to="moreInfoNeeded" >
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                <variable name="bpm_package" access="read" />
                <variable name="initiator" access="read" />
                <variable name="bpm_workflowDescription" access="read" />
                     var mail = actions.create("mail");
                     var prsn = initiator;
                     try {
                        var emailAddress =;
               = emailAddress;
                        mail.parameters.subject = "Content authoring task submitted with additional information";
                        mail.parameters.from =;
                        mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/notify_user_email_taskurl.ftl");                        
                        mail.parameters.text = "Default text goes here";
                        logger.log("send mail to "+;
                     } catch (error) {
                        logger.log("Failed sending mail to "+ + "  " + error);

My ftl file is the below:


A new workflow task has been created.
Please got to http://${url.context}/alfresco/command/ui/managetask?id=${}&type=${pooled.qnameType}&container=plain to view the workflow task.



However when i check my log file i get the following error:

DEBUG [org.alfresco.repo.jscript.ScriptLogger] Failed sending mail to admin ReferenceError: "companyhome" is not defined.

I have made use of companyhome in my process definition file to get the hold of an image and it worked.

Has anyone come across this before?