02-28-2012 04:02 AM
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn"
xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC"
xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema"
expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://activiti.org/bpmn20">
<process id="Finance3a2ca1ca" name="Finance invoice (begin with 3 users)">
<startEvent id="start" name="Start"
activiti:formKey="sgfwf:submitStartFinance3a2ca1ca"></startEvent>
<userTask id="modifyReview1" name="Validation 1"
activiti:assignee="${sgfwf_assignee1.properties.userName}"
activiti:formKey="sgfwf:modifyReviewTaskFinance3a2ca1ca">
<extensionElements>
<activiti:taskListener event="create"
class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>
if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate;
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;
var sendMail = task.getVariable('sgfwf_sendMailForAssignee1');
if (sendMail == true) {
var mail = actions.create("mail");
mail.parameters.to = sgfwf_assignee1.properties.email;
mail.parameters.subject = "Validation : " + bpm_workflowDescription;
//mail.parameters.from = "admin@alfresco.com";
//mail.parameters.text = "Mail for you :-)";
mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/Workflow Notification/wf-email.html_custom.ftl");
var templateArgs = new Array();
templateArgs['workflowTitle'] = task.name;
// Link to Modify the task (workflowPooled=true => view, false => edit)
templateArgs['workflowPooled'] = false;
templateArgs['workflowPriority'] = task.priority;
templateArgs['workflowDueDate'] = task.dueDate;
templateArgs['workflowMainDocument'] = sgfwf_mainDocument.nodeRef.toString();
templateArgs['workflowDescription'] = bpm_workflowDescription;
templateArgs['workflowId'] = "activiti$"+task.id;
var templateModel = new Array();
templateModel['args'] = templateArgs;
mail.parameters.template_model = templateModel;
mail.execute(bpm_package);
}
</activiti:string>
</activiti:field>
</activiti:taskListener>
<activiti:taskListener event="complete"
class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>execution.setVariable('sgfwf_approveRejectOutcome',task.getVariable('sgfwf_approveRejectOutcome'));
execution.setVariable('sgfwf_financialData',task.getVariable('sgfwf_financialData'));</activiti:string>
</activiti:field>
</activiti:taskListener>
</extensionElements>
</userTask>
<userTask id="modifyReview2" name="Validation 2"
activiti:assignee="${sgfwf_assignee2.properties.userName}"
activiti:formKey="sgfwf:modifyReviewTaskFinance3a2ca1ca">
<documentation>
Verify the arbitrary task was completed.
</documentation>
<extensionElements>
<activiti:taskListener event="create"
class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>
if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate;
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;
var sendMail = task.getVariable('sgfwf_sendMailForAssignee2');
if (sendMail == true) {
var mail = actions.create("mail");
mail.parameters.to = sgfwf_assignee2.properties.email;
mail.parameters.subject = "Validation : " + bpm_workflowDescription;
//mail.parameters.from = "admin@alfresco.com";
//mail.parameters.text = "Mail for you :-)";
mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/Workflow Notification/wf-email.html_custom.ftl");
var templateArgs = new Array();
templateArgs['workflowTitle'] = task.name;
// Link to Modify the task (workflowPooled=true => view, false => edit)
templateArgs['workflowPooled'] = false;
templateArgs['workflowPriority'] = task.priority;
templateArgs['workflowDueDate'] = task.dueDate;
templateArgs['workflowMainDocument'] = sgfwf_mainDocument.nodeRef.toString();
templateArgs['workflowDescription'] = bpm_workflowDescription;
templateArgs['workflowId'] = "activiti$"+task.id;
var templateModel = new Array();
templateModel['args'] = templateArgs;
mail.parameters.template_model = templateModel;
mail.execute(bpm_package);
}
</activiti:string>
…
02-11-2013 04:50 AM
function sendMail(params){
//mail action goes here;
}
<activiti:string>
<import resource="classpath:alfresco/extension/workflow/my-js-functions-.js">
sendMail(someParams);
</activiti:string>
02-11-2013 06:48 AM
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.