Hi all,
I would send an email to all user of my company using a system task with a mail connector where in the To field I add a script that select all user and create a string with all email.
But this is the exception that I obtain.
java.lang.reflect.InvocationTargetException
org.bonitasoft.engine.bpm.connector.ConnectorExecutionException:
org.bonitasoft.engine.core.connector.exception.SConnectorException:
org.bonitasoft.engine.expression.exception.SExpressionEvaluationException:
Script throws an exceptionSExpressionImpl [
name=getUserMail,
content=
import org.bonitasoft.engine.search.*;
import org.bonitasoft.engine.identity.*;
SearchOptionsBuilder so = new SearchOptionsBuilder(0, 100);
SearchResult<User> userResult = apiAccessor.getIdentityAPI().searchUsers(so.done());
String mailto = new String();
for (User u : userResult)
{
UserWithContactData proUser = apiAccessor.getIdentityAPI().getUserWithProfessionalDetails(u.getId());
mailto += ", "+proUser.getContactDactivityInstanceIdata().getEmail();
}
return mailto;
,
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
]
]
],
expressionKind=ExpressionKind [interpreter=GROOVY,
type=TYPE_READ_ONLY_SCRIPT
]
]
Thanks for attention,
Francesco