cancel
Showing results for 
Search instead for 
Did you mean: 

task - send e-mail and move content?

targa2000
Champ in-the-making
Champ in-the-making
In a workflow, after a task has been completed, can we send an e-mail and move the content to another space, and/or run a particular script?  If so, how?

And when a user starts advanced workflow on a content, can we have the document moved to a space as part of the workflow?
3 REPLIES 3

hsohaib
Champ on-the-rise
Champ on-the-rise
sure, it would be something like this :
- Sending an email when task done :


<event type="task-end">
    <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
        <runas>admin</runas>
        <script>
              mail.parameters.to = bpm_assignee.properties.email;
              mail.parameters.subject = "Approval Request ";
         mail.parameters.text = "Hi, a document been moved";
              mail.execute(bpm_package.children[0]);
       </script>
     </action>
</event>

- Moving the document to another space :

<event type="task-end">
    <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
        <runas>admin</runas>
        <script>
             var destination = companyhome.childByNamePath("Archives / someSpace");
             bpm_package.children[0].move();
       </script>
     </action>
</event>

if the workflow applies to more than one document you might wanna iterate the bpm_package.children array.

targa2000
Champ in-the-making
Champ in-the-making
thank you very much for your reply!  In what file would we define this?

hsohaib
Champ on-the-rise
Champ on-the-rise
in your process definition file(JPDL)