cancel
Showing results for 
Search instead for 
Did you mean: 

Mail as boundary event

k_kunti
Champ in-the-making
Champ in-the-making
Hi All

Is it possible to define mail as boundary event… e.g. sending mail at start, completion of task as well as sending repeated reminders.

Thanks in advance
krish
4 REPLIES 4

jbarrez
Star Contributor
Star Contributor
You should take a look at 'execution listeners' or 'task listeners'.

They allow you to do exactly that.

k_kunti
Champ in-the-making
Champ in-the-making
Hi

I need one clarification…. how do we call email service task inside 'execution listeners' or 'task listeners' . Or is it that we should write our own Java classes to send the email.


Thanks in advance
Krish

k_kunti
Champ in-the-making
Champ in-the-making
Hi

We can use in the following manner as well, using the org.activiti.engine.impl.bpmn.MailActivityBehavior as execution  listener:

This works as well

Thank you
Krish

<?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" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
<process id="SimpleUserTask" name="SimpleUserTask">
<startEvent id="startevent2" name="Start"></startEvent>


<userTask id="usertask2" name="User Task" activiti:formKey="formInclude/approve.form">

<extensionElements>
     <activiti:taskListener event="create" class="com.test.poc.DynamicAssignment" />
     <activiti:executionListener class="org.activiti.engine.impl.bpmn.MailActivityBehavior" event="start">
       
       
        <activiti:field name="to" expression="${assigneeemail}"/>
<activiti:field name="from" expression="kkrish@ty.com">
</activiti:field>
<activiti:field name="html">
<activiti:expression><![CDATA[ <html>
             <body>
               Hello  ${assignee},<br/><br/>
                 
               A new order has been allocated to you , the order value is  <FONT size="5" COLOR="#0000FF"> ${orderValue}</FONT> <b>please view the same in your inbox</b>.<br/><br/>
              
                              
               Kind regards,<br/>
                  
               TheCompany.
             </body>
           </html>
]]></activiti:expression>
</activiti:field>

    </activiti:executionListener>
</extensionElements>

</userTask>
<sequenceFlow id="flow3" name="" sourceRef="startevent2" targetRef="usertask2"></sequenceFlow>
<sequenceFlow id="flow4" name="" sourceRef="usertask2" targetRef="endevent2"></sequenceFlow>
<endEvent id="endevent2" name="End"></endEvent>



<boundaryEvent id="escalationTimer" cancelActivity="true" attachedToRef="usertask2">
<timerEventDefinition>
<timeDuration>PT60S</timeDuration>
</timerEventDefinition>
</boundaryEvent>
<sequenceFlow id="flow9" sourceRef="escalationTimer" targetRef="endevent6" />

<endEvent id="endevent6" name="End">
</endEvent>

</process>
</definitions>

jbarrez
Star Contributor
Star Contributor
Awesome!

I had forgotten about this feature. Thanks for posting it!