11-03-2009 08:27 AM
<transition name="moreInfoNeeded" to="moreInfoNeeded" >
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
<variable name="bpm_package" access="read" />
<variable name="initiator" access="read" />
<variable name="bpm_workflowDescription" access="read" />
<expression>
var mail = actions.create("mail");
var prsn = initiator;
try {
var emailAddress = prsn.properties.email;
mail.parameters.to = emailAddress;
mail.parameters.subject = "Content authoring task submitted with additional information";
mail.parameters.from = person.properties.email;
mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/notify_user_email_taskurl.ftl");
mail.parameters.text = "Default text goes here";
mail.execute(bpm_package);
logger.log("send mail to "+ prsn.properties.userName);
} catch (error) {
logger.log("Failed sending mail to "+ prsn.properties.userName + " " + error);
}
</expression>
</script>
</action>
</transition>
Hi,
A new workflow task has been created.
Please got to http://${url.context}/alfresco/command/ui/managetask?id=${pooled.id}&type=${pooled.qnameType}&contai... to view the workflow task.
Regards
Admin
DEBUG [org.alfresco.repo.jscript.ScriptLogger] Failed sending mail to admin ReferenceError: "companyhome" is not defined.
11-03-2009 08:43 AM
<variable name="companyhome" access="read" />
Caused by: freemarker.core.InvalidReferenceException: Expression url is undefined on line 4, column 24 in workspace://SpacesStore/2005cd22-e18f-4112-8442-e0a8558725c0.
11-03-2009 09:31 AM
11-03-2009 10:40 AM
11-03-2009 10:59 AM
11-03-2009 11:16 AM
11-04-2009 05:27 AM
11-04-2009 11:15 AM
However i was not find out the values for the 'id=jbpm$2' and 'type=${pooled.qnameType}' from any of the variables that are declared there in the class. I'm assuming that these values need to be put in the model which can be made use in the ftl
11-09-2009 07:33 AM
<task name="ppdwf:contentAuthorTask" swimlane="content_author" >
<event type="task-create">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
executionContext.setVariable("taskInstanceID", taskInstance.id);
executionContext.setVariable("taskInstanceName", taskInstance.name);
</script>
</action>
</event>
</task>
<transition name="moreInfoNeeded" to="moreInfoNeeded" >
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
<variable name="bpm_package" access="read" />
<variable name="initiator" access="read" />
<variable name="bpm_workflowDescription" access="read" />
<variable name="companyhome" access="read"></variable>
<variable name="taskInstance" access="read" />
<expression>
var mail = actions.create("mail");
var prsn = initiator;
try {
var emailAddress = prsn.properties.email;
var taskType = executionContext.getVariable("taskInstanceName").substring(executionContext.getVariable("taskInstanceName").indexOf(":")+1);
var taskURL = "http://localhost:8080/alfresco/command/ui/managetask?id=jbpm$" + executionContext.getVariable("taskInstanceID") + "&type={com.pixs.workflowuri}" + taskType + "&container=plain";
mail.parameters.to = emailAddress;
mail.parameters.subject = "Content authoring task submitted with additional information";
mail.parameters.from = person.properties.email;
mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/notify_user_email_taskurl.ftl");
mail.parameters.text = "Default text goes here. Please click on" + taskURL + " to go to the task";
mail.execute(bpm_package);
logger.log("send mail to "+ prsn.properties.userName + "taskURL: " + taskURL);
} catch (error) {
logger.log("Failed sending mail to "+ prsn.properties.userName + "taskURL: " + taskURL + " " + error);
}
</expression>
</script>
</action>
</transition>
11-09-2009 02:54 PM
parameters
an associative array (map) of the parameters for the action. For example mail.parameters.subject. Each parameter is keyed by a String. Parameters can be modified and new parameters added.
mail.parameters.taskid = executionContext.getVariable("taskInstanceID");
mail.parameters.tasktype = executionContext.getVariable("taskInstanceName");
// add objects for the taskid, taskName and the url for the taskInstance related information
model.put("taskInstanceObj", obj);
New task has been created. Please click on ${taskInstanceObj.taskURL} to view the task.
ERROR [org.springframework.beans.factory.support.DefaultListableBeanFactory] Destroy method on bean with name 'mail' threw an exception
java.lang.NoClassDefFoundError: org.alfresco.repo.action.executer.TaskInstanceObject
at java.lang.Class.getDeclaredMethodsImpl(Native Method)
at java.lang.Class.getDeclaredMethods(Class.java:612)
at org.apache.cxf.common.injection.ResourceInjector.getAnnotatedMethods(ResourceInjector.java:347)
at org.apache.cxf.common.injection.ResourceInjector.getPreDestroyMethods(ResourceInjector.java:340)
at org.apache.cxf.common.injection.ResourceInjector.invokePreDestroy(ResourceInjector.java:317)
at org.apache.cxf.common.injection.ResourceInjector.destroy(ResourceInjector.java:96)
at org.apache.cxf.bus.spring.Jsr250BeanPostProcessor.postProcessBeforeDestruction(Jsr250BeanPostProcessor.java:80)
at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:135)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:344)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:317)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:290)
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:730)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:708)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:675)
at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:338)
at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:74)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:3882)
at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4523)
at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:924)
at org.apache.catalina.startup.HostConfig.undeployApps(HostConfig.java:1191)
at org.apache.catalina.startup.HostConfig.stop(HostConfig.java:1162)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:313)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1086)
at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1098)
at org.apache.catalina.core.StandardEngine.stop(StandardEngine.java:448)
at org.apache.catalina.core.StandardService.stop(StandardService.java:584)
at org.apache.catalina.core.StandardServer.stop(StandardServer.java:744)
at org.apache.catalina.startup.Catalina.stop(Catalina.java:628)
at org.apache.catalina.startup.Catalina$CatalinaShutdownHook.run(Catalina.java:671)
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.