cancel
Showing results for 
Search instead for 
Did you mean: 

Mail Task - ActivitiIllegalArgumentException

upforsin
Star Collaborator
Star Collaborator

Hello,

Eventually, I want to send an email notification based on Freemarker template when the workflow is finished. I know I can do it using Javascript or Java but I saw this is also possible with Activiti itself (I will allow me to use Freemarker template easily).

Unfortunately, when when I create an Alfresco Mail Task in the process definition, I get an ActivitiIllegalArgumentException error.

myProject       |  2020-02-16 11:42:34,727  ERROR [impl.interceptor.CommandContext] [http-nio-8080-exec-10] Error while closing command context
myProject       |  org.activiti.engine.ActivitiIllegalArgumentException: Field definition uses unexisting field 'mail.parameters.subject' on class org.alfresco.repo.workflow.activiti.script.AlfrescoScriptDelegate

This is part of my process definition:

    <serviceTask id="alfrescoMailtask1" name="Alfresco Mail Task" activiti:class="org.alfresco.repo.workflow.activiti.script.AlfrescoScriptDelegate">
      <extensionElements>
        <activiti:field name="script">
          <activiti:string><![CDATA[var mail = actions.create("mail");
mail.execute(bpm_package);]]></activiti:string>
        </activiti:field>
        <activiti:field name="mail.parameters.subject">
          <activiti:string><![CDATA[Rejected]]></activiti:string>
        </activiti:field>
        <activiti:field name="mail.parameters.to">
          <activiti:expression><![CDATA[${initiator.properties.email}]]></activiti:expression>
        </activiti:field>
        <activiti:field name="mail.parameters.html">
          <activiti:expression><![CDATA[<html>
            <body>
              Hello ${male ? 'Mr.' : 'Mrs.' } ${recipientName},<br/><br/>

              As of ${now}, the process has been rejected <b>rejected</b>.<br/><br/>

              Greetings,<br/>

              The Company.
            </body>
          </html>]]></activiti:expression>
        </activiti:field>
      </extensionElements>
    </serviceTask>

What's wrong with it?

PS. How can I populate Freemarker model with additional variable? Is execution.setVariable('foo', 'test'); enough?

howkymike
Alfresco Developer
0 REPLIES 0
Getting started

Explore our Alfresco products with the links below. Use labels to filter content by product module.