email connector error

1
0
-1

Hello,
I have many email connector in my process. all connectors are working well.
Then, I created an email connector has a message with groovy script.

In the script, I would like to get the reason from bdm. the code is as below,

     def content = 'The process was terminated by the user. <br>Reason for termination<br>'
     + sVar1.getTerminateReason() +
     '<br><br><a href="http://localhost:8080/bonita/login.jsp">BPM Portal</a> <br><br><br>Title  <br>';

     return content;

However, I got the error

01-Feb-2019 15:21:40.179 SEVERE [Bonita-Worker-1-05] org.bonitasoft.engine.log.technical.TechnicalLoggerSLF4JImpl.log THREAD_ID=147 | HOSTNAME=WNETAP262 | TENANT_ID=1 | The work [ExecuteConnectorOfActivity: flowNodeInstanceId = 480123, connectorDefinitionName = Termination Email] failed. The failure will be handled.
01-Feb-2019 15:21:40.230 SEVERE [Bonita-Worker-1-05] org.bonitasoft.engine.log.technical.TechnicalLoggerSLF4JImpl.log THREAD_ID=147 | HOSTNAME=WNETAP262 | TENANT_ID=1 | org.bonitasoft.engine.expression.exception.SExpressionEvaluationException : "PROCESS_DEFINITION_ID=6142450842445138160 | PROCESS_NAME=SecurityAdvisoryProcess | PROCESS_VERSION=1.0 | PROCESS_INSTANCE_ID=24016 | ROOT_PROCESS_INSTANCE_ID=24015 | FLOW_NODE_DEFINITION_ID=5647952987131503349 | FLOW_NODE_INSTANCE_ID=480123 | FLOW_NODE_NAME=Terminate Email | CONNECTOR_IMPLEMENTATION_CLASS_NAME=Termination Email | CONNECTOR_INSTANCE_ID=480053 | groovy.lang.MissingMethodException: No signature of method: java.lang.String.positive() is applicable for argument types: () values: []
Possible solutions: notify(), size(), size(), tokenize()"

Any help would be appreciated
Thanks in advance

1 answer

1
+1
-1
This one is the BEST answer!

Hi

You should not use the dreaded string-concatenation!

try this:

def content = """The process was terminated by the user. <br>Reason for termination
sVar1.getTerminateReason()
<a href="http://localhost:8080/bonita/login.jsp">BPM Portal</a>
Title
""";

Comments

Submitted by donghee.baik on Mon, 02/04/2019 - 15:27

Thanks a lot.
I updated the script and it works well.

  def content = """The process was terminated by the user. <br>Reason for termination<br>"""+ 
  sVar1.getTerminateReason()+"""<a href="http://localhost:8080/bonita/login.jsp">BPM Portal</a><br> 
 <br><br>Title<br>""";
 return content;
Notifications