Email Task URL to user


at the end of TASK 1 i create one email connector

in email body , i switch to script editor and as per documentation i paste following code ,

StringBuffer buffer = new StringBuffer("URL: <a href=\"");
buffer.append(processName); buffer.append("--");
buffer.append(processVersion); buffer.append("--");
buffer.append("$entry&mode=app&task=");                      *<--- warning Prompt : entry cannot be resolved. It may lead to runtime errors.*
return buffer.toString();

but in editor i gives following warning error .

entry cannot be resolved. It may lead to runtime errors.

i try to run it but connector fails at execution

how to achieve it .


Submitted by cldrzdz on Tue, 09/09/2014 - 14:39

It worked fine for me.

Here some changes to use the code in a BonitaBPM script conector to make a link to the current task.

StringBuffer buffer = new StringBuffer("URL: <a href=\""); buffer.append("http://"); buffer.append("localhost"); // write your server name or IP buffer.append(":"); buffer.append("8080"); //the port where the server is running buffer.append("/bonita?ui=form&locale=es#form="); //change locale=es by locale=en for english buffer.append(apiAccessor.processAPI.getProcessInstance(processInstanceId).getName()); buffer.append("--"); buffer.append(apiAccessor.processAPI.getProcessDefinition(processDefinitionId).getVersion()); buffer.append("--"); //version buffer.append(apiAccessor.processAPI.getActivityInstance(activityInstanceId).getName()); buffer.append("%24entry&mode=app&task="); //note I changed $ by %24 buffer.append(activityInstanceId);

buffer.append("\">Click here to go to the task"); //write your own link label return buffer.toString();

1 answer


In your line 10, you should add a backslash before $ sign:



Submitted by kppatel on Sat, 05/10/2014 - 08:38

Thank you for answer , i tried to execute give following error

org.bonitasoft.engine.bpm.connector.ConnectorExecutionException: org.bonitasoft.engine.core.connector.exception.SConnectorException: org.bonitasoft.engine.expression.exception.SInvalidExpressionException: Declared return type class java.lang.Long is not compatible with evaluated type class java.lang.Integer for expression activityInstanceId
Submitted by haris.subasic on Sun, 05/11/2014 - 18:27

You have a mismatch in some Groovy script, Return type is declared as Long, while the script returns an Integer value. Try to modify your script or to change the return type of the expression.

Submitted by kppatel on Wed, 05/14/2014 - 09:26

how to specify return type in groovy script

i can't figure out

Submitted by kppatel on Thu, 05/15/2014 - 07:23

there is disable return type : java.lang.string and script's return type tostring() what mismatch how to resolve it

Submitted by haris.subasic on Thu, 05/15/2014 - 09:47

Script provided in the other thread here .

Submitted by kppatel on Thu, 05/15/2014 - 13:46

Thank you soo much

Submitted by grigoriadis on Fri, 02/13/2015 - 13:15

I also had the same problem and it was solved just by replacing " with '