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("http://");
buffer.append(host);
buffer.append(":");
buffer.append(port);
buffer.append("/bonita?ui=form&locale=en#form=");
buffer.append(processName); buffer.append("--");
buffer.append(processVersion); buffer.append("--");
buffer.append(activityName);
buffer.append("$entry&mode=app&task="); *<--- warning Prompt : entry cannot be resolved. It may lead to runtime errors.*
buffer.append(activityInstanceId);
buffer.append("\">here</a>");
return buffer.toString();
buffer.append("http://");
buffer.append(host);
buffer.append(":");
buffer.append(port);
buffer.append("/bonita?ui=form&locale=en#form=");
buffer.append(processName); buffer.append("--");
buffer.append(processVersion); buffer.append("--");
buffer.append(activityName);
buffer.append("$entry&mode=app&task="); *<--- warning Prompt : entry cannot be resolved. It may lead to runtime errors.*
buffer.append(activityInstanceId);
buffer.append("\">here</a>");
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 .
1 answer
In your line 10, you should add a backslash before $ sign:
Comments
Thank you for answer , i tried to execute give following error
java.lang.reflect.InvocationTargetException
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
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
how to specify return type in groovy script
i can't figure out
there is disable return type : java.lang.string and script's return type tostring() what mismatch how to resolve it
Thank you soo much
I also had the same problem and it was solved just by replacing " with '
Comments
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();