Send email to task initiator

I'm beginner and I'm doing the exercises proposed in the bonitacamp.

I'm having trouble sending email with the task initiator as recipient. If I put the fixed recipient, the connector works correctly.

I'm using the proposed script in the exercise, but it is failing to run. I'm using 2022.1 version

The script is:

import org.bonitasoft.engine.identity.UserNotFoundException

try{
    def processInitiator = apiAccessor.getIdentityAPI().getUser(apiAccessor.getProcessAPI()
            .getProcessInstance(processInstanceId)
            .getStartedBy())
    
    return apiAccessor.getIdentityAPI().getUserContactData(processInitiator.id, false).email
    
}catch(UserNotFoundException e){
    // Handle UserNotFoundException here
    // Was the process started by the system (e.g.: a start event) ?
    // Has the user who started the process instance been deleted ?
}

thanks for the help

Hello  lucianocredicatarina,

Could you send the logs with the errors that you're facing, please?

thanks!

Hello.

Thank you very much for the feedback, but I managed to fix the connector.

Thanks for the contact