Hi, sry of course.
But I also see this is what I use for Actor:
import org.bonitasoft.engine.identity.User;
import org.bonitasoft.engine.identity.UserCriterion;
List result = new ArrayList();
List users = apiAccessor.getIdentityAPI().getUsersInGroup(authorization.placeholder.toLong(), 0, 100, UserCriterion.FIRST_NAME_ASC);
for (User user : users) {
result.add(user.id)
}
return result
placeholder is the String with the GroupId
This is the Error:
2017-05-10 13:25:04.756 +0200 INFO: org.bonitasoft.engine.api.impl.ProcessAPIImpl THREAD_ID=459 | HOSTNAME=Bon01 | TENANT_ID=1 | The user <stephane.walrave> has executed the task [name = <Vérification des données>, display name = <Vérification des données>, id = <200008>, parent process instance = <10003>, root process instance = <10003>, process definition = <8404392087493323471>] with task inputs: {isApproved=oui}
2017-05-10 13:25:05.056 +0200 SEVERE: org.bonitasoft.engine.execution.work.FailureHandlingBonitaWork THREAD_ID=468 | HOSTNAME=Bon01 | TENANT_ID=1 | The work [ExecuteFlowNodeWork: processInstanceId:10003, flowNodeInstanceId: 200010] failed. The failure will be handled.
2017-05-10 13:25:05.063 +0200 SEVERE: org.bonitasoft.engine.execution.work.FailureHandlingBonitaWork THREAD_ID=468 | HOSTNAME=Bon01 | TENANT_ID=1 | org.bonitasoft.engine.core.process.instance.api.exceptions.SActivityStateExecutionException : “PROCESS_DEFINITION_ID=8404392087493323471 | PROCESS_NAME=Access Authorization - Arrival | PROCESS_VERSION=1.1 | PROCESS_INSTANCE_ID=10003 | ROOT_PROCESS_INSTANCE_ID=10003 | FLOW_NODE_DEFINITION_ID=6185471763732643814 | FLOW_NODE_INSTANCE_ID=200010 | FLOW_NODE_NAME=Dep. Manager confirmation | org.bonitasoft.engine.core.filter.exception.SUserFilterExecutionException: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: FLOW_NODE_INSTANCE_ID=200010 | Declared return type class java.lang.Long is not compatible with evaluated type class java.util.ArrayList for expression userId()”
org.bonitasoft.engine.core.process.instance.api.exceptions.SActivityStateExecutionException: PROCESS_DEFINITION_ID=8404392087493323471 | PROCESS_NAME=Access Authorization - Arrival | PROCESS_VERSION=1.1 | PROCESS_INSTANCE_ID=10003 | ROOT_PROCESS_INSTANCE_ID=10003 | FLOW_NODE_DEFINITION_ID=6185471763732643814 | FLOW_NODE_INSTANCE_ID=200010 | FLOW_NODE_NAME=Dep. Manager confirmation | org.bonitasoft.engine.core.filter.exception.SUserFilterExecutionException: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: FLOW_NODE_INSTANCE_ID=200010 | Declared return type class java.lang.Long is not compatible with evaluated type class java.util.ArrayList for expression userId()
And E-Mail Error:
2017-05-10 13:33:42.056 +0200 INFO: org.bonitasoft.engine.api.impl.ProcessAPIImpl THREAD_ID=65 | HOSTNAME=Bon01 | TENANT_ID=1 | The user <stephane.walrave> has executed the task [name = <Vérification des données>, display name = <Vérification des données>, id = <200016>, parent process instance = <10005>, root process instance = <10005>, process definition = <4985366349716173731>] with task inputs: {isApproved=oui}
2017-05-10 13:33:46.376 +0200 SEVERE: org.bonitasoft.engine.execution.work.FailureHandlingBonitaWork THREAD_ID=476 | HOSTNAME=Bon01 | TENANT_ID=1 | org.bonitasoft.engine.expression.exception.SExpressionEvaluationException : "PROCESS_DEFINITION_ID=4985366349716173731 | PROCESS_NAME=Access Authorization - Arrival | PROCESS_VERSION=1.1 | PROCESS_INSTANCE_ID=10005 | ROOT_PROCESS_INSTANCE_ID=10005 | FLOW_NODE_DEFINITION_ID=5942250958390834156 | FLOW_NODE_INSTANCE_ID=200018 | FLOW_NODE_NAME=Dep. Manager confirmation | CONNECTOR_IMPLEMENTATION_CLASS_NAME=testMail | CONNECTOR_INSTANCE_ID=200004 | Groovy script throws an exception of type class org.codehaus.groovy.runtime.typehandling.GroovyCastException with message = Cannot cast object ‘141’ with class ‘java.lang.Long’ to class ‘java.util.List’
Expression : SExpressionImpl [name=totest(), content=import org.bonitasoft.engine.identity.ContactData;
import org.bonitasoft.engine.identity.Group;
import org.bonitasoft.engine.identity.User;
import org.bonitasoft.engine.identity.UserCriterion;
List test= authorization.placeholder.toLong()
List usersInGroup=apiAccessor.getIdentityAPI().getUsersInGroup(test(), 0, 100, UserCriterion.FIRST_NAME_ASC);
StringBuilder sb=new StringBuilder();
for (User user:usersInGroup){
//get professional contact data<br />
ContactData contactData = apiAccessor.getIdentityAPI().getUserContactData(user.getId(), false);
if (contactData!=null && contactData.getEmail()!=null && !contactData.getEmail().isEmpty()){
sb.append(contactData.getEmail()).append(",");
}
}
return sb;, returnType=java.lang.String, dependencies=[SExpressionImpl [name=apiAccessor, content=apiAccessor, returnType=org.bonitasoft.engine.api.APIAccessor, dependencies=, expressionKind=ExpressionKind [interpreter=NONE, type=TYPE_ENGINE_CONSTANT]], SExpressionImpl [name=authorization, content=authorization, returnType=com.company.model.AccessAuthorization, dependencies=, expressionKind=ExpressionKind [interpreter=NONE, type=TYPE_BUSINESS_DATA]]], expressionKind=ExpressionKind [interpreter=GROOVY, type=TYPE_READ_ONLY_SCRIPT]]"
org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: PROCESS_DEFINITION_ID=4985366349716173731 | PROCESS_NAME=Access Authorization - Arrival | PROCESS_VERSION=1.1 | PROCESS_INSTANCE_ID=10005 | ROOT_PROCESS_INSTANCE_ID=10005 | FLOW_NODE_DEFINITION_ID=5942250958390834156 | FLOW_NODE_INSTANCE_ID=200018 | FLOW_NODE_NAME=Dep. Manager confirmation | CONNECTOR_IMPLEMENTATION_CLASS_NAME=testMail | CONNECTOR_INSTANCE_ID=200004 | Groovy script throws an exception of type class org.codehaus.groovy.runtime.typehandling.GroovyCastException with message = Cannot cast object ‘141’ with class ‘java.lang.Long’ to class ‘java.util.List’
Expression : SExpressionImpl [name=totest(), content=import org.bonitasoft.engine.identity.ContactData;
import org.bonitasoft.engine.identity.Group;
import org.bonitasoft.engine.identity.User;
import org.bonitasoft.engine.identity.UserCriterion;
List test= authorization.placeholder.toLong()
List usersInGroup=apiAccessor.getIdentityAPI().getUsersInGroup(test(), 0, 100, UserCriterion.FIRST_NAME_ASC);
StringBuilder sb=new StringBuilder();
for (User user:usersInGroup){
//get professional contact data<br />
ContactData contactData = apiAccessor.getIdentityAPI().getUserContactData(user.getId(), false);
if (contactData!=null && contactData.getEmail()!=null && !contactData.getEmail().isEmpty()){
sb.append(contactData.getEmail()).append(",");
}
}
return sb;, returnType=java.lang.String, dependencies=[SExpressionImpl [name=apiAccessor, content=apiAccessor, returnType=org.bonitasoft.engine.api.APIAccessor, dependencies=, expressionKind=ExpressionKind [interpreter=NONE, type=TYPE_ENGINE_CONSTANT]], SExpressionImpl [name=authorization, content=authorization, returnType=com.company.model.AccessAuthorization, dependencies=, expressionKind=ExpressionKind [interpreter=NONE, type=TYPE_BUSINESS_DATA]]], expressionKind=ExpressionKind [interpreter=GROOVY, type=TYPE_READ_ONLY_SCRIPT]]