Obtain the email of the user who started the process

How to obtain the email of the user who started the process?
The idea is to send an email to the initiator of the process at the end, so we should load that email in a variable, but I don't know how-

Hello,

In groovy script you have different code templates for things like this.

import org.bonitasoft.engine.identity.UserNotFoundException

try{
def processInitiator = apiAccessor.getIdentityAPI().getUser(apiAccessor.getProcessAPI()
.getProcessInstance(processInstanceId)
.getStartedBy())
def proContactData = apiAccessor.getIdentityAPI().getUserContactData(processInitiator.id, false).email

return proContactData

}catch(UserNotFoundException e){
}

In the above example I'm returning the Professional contact data Email.

Thank you!