AnsweredAssumed Answered

Send mail in javascript [ inside workflow ]

Question asked by g_rathod on Mar 11, 2009
Hi,

I have one workflow triggered on space , processing written in javascript file.

myworkflow.js

var workflow = actions.create("start-workflow");
  workflow.parameters.workflowName = "jbpm$twf:reviewpooled";
  workflow.parameters.bpm_workflowDescription = "Review process of custom content";
  workflow.parameters.bpm_groupAssignee = people.getGroup("GROUP_EMAIL_CONTRIBUTORS");
  workflow.parameters.startTaskTransition="";

Now I want to add Email code in this block once reviewer approve the content Email should be sent to group people.

I tried following:

 
  // create workflow action
  var workflow = actions.create("start-workflow");
  workflow.parameters.workflowName = "jbpm$twf:reviewpooled";
  workflow.parameters.bpm_workflowDescription = "Review process of Trident content";
  workflow.parameters.bpm_groupAssignee = people.getGroup("GROUP_EMAIL_CONTRIBUTORS");
  workflow.parameters.startTaskTransition="";

  var mail = actions.create("mail");
  var l_doc_author = document.properties["cm:creator"];
  var l_doc_author_person = people.getPerson(l_doc_author);
  var l_doc_author_mail = l_doc_author_person.properties["cm:email"];
 
  mail.parameters.to = l_doc_author_mail;
  mail.parameters.subject = "Review process of Trident content";
  mail.parameters.from = "admin@myworkflow.com";
  mail.parameters.text = "Review Task - It's done";
  mail.execute(bpm_package);
 
  // execute action against a document   
  workflow.execute(document);


here I am not getting any bpm related variables and getting errors related bpm related variables.
Can you please give hint how to assign that or make my mail code work in js.

Thanks,

Outcomes