03-15-2007 09:24 AM
mail.parameters.text = "Please review and if you like the changes, approve this task. You can click here http://localhost:8080/alfresco/command/task/end/jbpm$" + bpm_taskId + "/approve to instantly approve.";03-15-2007 12:08 PM
id: jbpm$87
name: wcmwf:reviewTask
title: Review
description: Review Documents to approve or reject them
state: IN_PROGRESS
path: jbpm$43-@review.0
transitions: 2
transition: reject , title: reject , desc: reject
transition: approve , title: approve , desc: approve
properties: 20
{http://www.alfresco.org/model/bpm/1.0}dueDate = null
{http://www.alfresco.org/model/bpm/1.0}context = null
{http://www.alfresco.org/model/bpm/1.0}description = fds
{http://www.alfresco.org/model/bpm/1.0}pooledActors = []
{http://www.alfresco.org/model/content/1.0}created = 2007-03-15 11:07:02.0
{http://www.alfresco.org/model/bpm/1.0}outcome = EmailNotification
{http://www.alfresco.org/model/bpm/1.0}completionDate = null
{http://www.alfresco.org/model/bpm/1.0}status = Not Yet Started
{http://www.alfresco.org/model/wcmworkflow/1.0}reviewType = Parallel
{http://www.alfresco.org/model/wcmworkflow/1.0}fromPath = alfresco–admin:/www
{http://www.alfresco.org/model/content/1.0}owner = admin
{http://www.alfresco.org/model/bpm/1.0}packageActionGroup =
{http://www.alfresco.org/model/bpm/1.0}assignees = [workspace://SpacesStore/4ff9de26-d27a-11db-8e7c-9f6ea315720d]
{http://www.alfresco.org/model/bpm/1.0}priority = 3
{http://www.alfresco.org/model/bpm/1.0}startDate = null
{http://www.alfresco.org/model/wcmworkflow/1.0}label = fds
{http://www.alfresco.org/model/bpm/1.0}percentComplete = 0
{http://www.alfresco.org/model/bpm/1.0}taskId = 87
{http://www.alfresco.org/model/bpm/1.0}package = avm://alfresco–workflow-34f5dd65-d30f-11db-adab-4b59abb3e52b/-1;www
{http://www.alfresco.org/model/bpm/1.0}packageItemActionGroup = edit_wcm_package_item_actions03-15-2007 12:53 PM
01-07-2008 07:48 AM
01-08-2008 05:39 AM
<task-node name="reviewX">
<event type="task-create">
<script>
<variable name="myTaskId" access="read,write" />
<expression>myTaskId = "jbpm$"+ executionContext.getTaskInstance().getId();</expression>
</script>
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
<!– create mail action–>
var mail = actions.create("mail");
var mydoc=bpm_package.children[0];
var gpeSender = new Array();
gpeSender[0]="GROUP_Y";
mail.parameters.to_many = gpeSender;
mail.parameters.subject = "[SG]Un document est àvalider";
mail.parameters.from = "alfresco@knowings.com";
var myTemplate=companyhome.childByNamePath("Dictionnaire des Données/Modèles d'Emails/workflow/newTask_workflow_mail.ftl");
var args = new Array();
args["id"]=myTaskId;
args["type"]="reviewX";
mail.parameters.text = mydoc.processTemplate(myTemplate,args);
<!– execute action against a document–>
mail.execute(bpm_package);
</script>
</action>
</event>
<task name="mytask1" swimlane="myswimlane" />
<transition name="approve" to="reviewY"></transition>
<transition name="reject" to="revise"></transition>
</task-node>02-02-2011 07:05 AM
<start-state name="Start">
<task name="wfTria:inizio" swimlane="initiator"></task>
<event type="node-leave">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<runas>admin</runas>
<script>
try {
var mail = actions.create("mail");
<!– mail.parameters.from = initiator.properties.email; –>
mail.parameters.to = "enrico_zeranto@mytria.it";
mail.parameters.subject = "[Afresco] Ti è stato assegnato un workflow";
<!– Creazione template –>
var myTemplate=companyhome.childByNamePath("Data Dictionary/Email Templates/wf_invitation.ftl");
var args = new Array();
args["wf_name"]="Opportunity";
mail.parameters.text = bpm_package.children[0].processTemplate(myTemplate,args);
<!– Testo del messaggio alternativo al template, nel caso in cui non venga trovato –>
mail.parameters.text = initiator.properties.firstName + " "
+ initiator.properties.lastName + " ti ha assegnato un workflow.
\u000D\u000D" + "Accedi alla console Alfresco per visualizzare i task
a te assegnati";
mail.execute(bpm_package);
} catch (e){
logger.log("node [Start], error durante l'invio della mail di segnalazione di attivazione WF." + e);
}
</script>
</action>
</event>
<transition to="Decidi numero e nome progetto"></transition>
</start-state>Sei stato assegnato ad un workflow.
<#– Accedi alla console Alfresco (${url.serverPath}${url.context}) per visualizzare i task a te assegnati. –>
<#assign keys = args?keys>
<#list keys as arg>
${arg}
</#list>
02-02-2011 08:10 AM
Hi,
I'm interested to this topic why I want to send an email from template, and pass to this template some params.
I try the code that you've posted, but I can't read the args parameter inside the template.
This is my node inside the WF that send the mail:<start-state name="Start">
<task name="wfTria:inizio" swimlane="initiator"></task>
<event type="node-leave">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<runas>admin</runas>
<script>
try {
var mail = actions.create("mail");
<!– mail.parameters.from = initiator.properties.email; –>
mail.parameters.to = "enrico_zeranto@mytria.it";
mail.parameters.subject = "[Afresco] Ti è stato assegnato un workflow";
<!– Creazione template –>
var myTemplate=companyhome.childByNamePath("Data Dictionary/Email Templates/wf_invitation.ftl");
var args = new Array();
args["wf_name"]="Opportunity";
mail.parameters.text = bpm_package.children[0].processTemplate(myTemplate,args);
<!– Testo del messaggio alternativo al template, nel caso in cui non venga trovato –>
mail.parameters.text = initiator.properties.firstName + " "
+ initiator.properties.lastName + " ti ha assegnato un workflow.
\u000D\u000D" + "Accedi alla console Alfresco per visualizzare i task
a te assegnati";
mail.execute(bpm_package);
} catch (e){
logger.log("node [Start], error durante l'invio della mail di segnalazione di attivazione WF." + e);
}
</script>
</action>
</event>
<transition to="Decidi numero e nome progetto"></transition>
</start-state>
And this the tempalte:Sei stato assegnato ad un workflow.
<#– Accedi alla console Alfresco (${url.serverPath}${url.context}) per visualizzare i task a te assegnati. –>
<#assign keys = args?keys>
<#list keys as arg>
${arg}
</#list>
And the mail is not send.
Can you help me or post your template that read args params?
Thank you
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.