getting-started/configure-email-connector not working

https://documentation.bonitasoft.com/bonita/2022.1/getting-started/configure-email-connector

When pasting this code into the TO field : apiAccessor.getIdentityAPI().getUserContactData(taskAssigneeId, false).email

and testing it, I get this error:

java.lang.reflect.InvocationTargetException
org.bonitasoft.engine.bpm.connector.ConnectorExecutionException: USERNAME=install | org.bonitasoft.engine.core.connector.exception.SConnectorException: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: Groovy script throws an exception of type class org.bonitasoft.engine.identity.UserNotFoundException with message = The technical user is not a usable user
Expression : SExpressionImpl [name=to(), content=apiAccessor.getIdentityAPI().getUserContactData(taskAssigneeId, false).email

, 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=taskAssigneeId, content=taskAssigneeId, returnType=java.lang.Long, dependencies=[], expressionKind=ExpressionKind [interpreter=NONE, type=TYPE_ENGINE_CONSTANT]]], expressionKind=ExpressionKind [interpreter=GROOVY, type=TYPE_READ_ONLY_SCRIPT]]

I've been able to test it putting a random fake account and verifying it arrives on the fake mail server so something in the script must be wrong.

Hello,

as the message says: "The technical user is not a usable user". You are trying to execute the process with a technical user, and not a "real" user like "walter.bates" or similar. The script tries to get the email address of the user to whom the task is assigned and the technical user has no email address which results in error.

HTH

1 Like

I had an error on the condition to run the process where it sends the email so I was looking at the wrong place, it's working now.

Hello
Just saw the tutorial. Assuming the issue is related to the apiAccessor.getIdentityAPI().getUserContactData(taskAssigneeId, false).email


In place of Using Java API, why dont you use the Email address directly.
Usually i save the correct email address inside a process variable or Database.
In the Email recipient , simply put the variable or call the Database column.

Regards

I also tried removing the script and placing a hardcoded fake email, then I run the example and after giving it a satisfaction level lower than 3 it doesn't send any email. So not sure anymore where it is failing frown