AnsweredAssumed Answered

MailTask and ExecutionListener field injection

Question asked by pitagoras on Jul 11, 2012
Latest reply on Jul 16, 2012 by frederikheremans1
Hi,
I´m trying to define a listener over a mail task, with the purpose of storing the fields of a the sent mail in a local database.

So I define in my MailTask:


    <serviceTask id="sendQuoteMail" name="Send Quote" activiti:type="mail">
      <extensionElements>
        <activiti:executionListener event="start" class="delegates.MailSaver"></activiti:executionListener>
        <activiti:field name="to" expression="${quote.customer.email}"></activiti:field>
        <activiti:field name="from" expression="user@domain.com"></activiti:field>
        <activiti:field name="subject" expression="your quote ${quote.businessKey}"></activiti:field>
        <activiti:field name="html">
          <activiti:expression><![CDATA[${quote.emailString}]]></activiti:expression>
        </activiti:field>
      </extensionElements>
    </serviceTask>


And define a class:

public class MailSaver implements ExecutionListener {

   private String from;
   private String to;
   private String subject;
   private String html;
   private String text;
   

   @Override
   public void notify(DelegateExecution arg0) throws Exception {
           …
       }

        public void setFrom(String from) ….
        … and all other public gettrs and setters here…
}

I´m using activiti-engine 5.9
I tried also to bind the listener to the 'end' event.

The listener is called but no field is injected to the listener.
Am I missing something?
Thank you!

Outcomes