How can I retrieve the initiator's id and his/her email using a groovy script?

Hi there. I’m trying to retrieve the initiator’s id and email using this groovy script:

import org.bonitasoft.engine.identity.ContactData;
import org.bonitasoft.engine.bpm.process.ProcessInstance;
return(ContactData.getEmail(ProcessInstance.getStartedBy()));

But I get this error in the log:

groovy.lang.MissingMethodException: No signature of method: static org.bonitasoft.engine.bpm.process.ProcessInstance.getStartedBy() is applicable for argument types: () values:

Any hint is very much appreciated. Level:Beginner.

import java.util.logging.Logger; Logger logger= Logger.getLogger("org.bonitasoft");

logger.severe(“\tgetUser”);

String usergetProcessInstanceInitiatorPersonalContactInfo = BonitaUsers.getProcessInstanceInitiatorPersonalContactInfo(apiAccessor,processInstanceId).getEmail();
logger.severe("\tgetUser personal email = " + usergetProcessInstanceInitiatorPersonalContactInfo);

String usergetProcessInstanceInitiatorProfessionalContactInfo = BonitaUsers.getProcessInstanceInitiatorProfessionalContactInfo(apiAccessor,processInstanceId).getEmail();
logger.severe("\tgetUser professional email = " + usergetProcessInstanceInitiatorProfessionalContactInfo);

return “whichever you need”;

regards
Seán

PS: As this reply answers your question, please mark as resolved by ticking the tick mark on the left of this reply.

PPS

A Tip on displaying CODE/LOGS correctly in Posts:

Do not use the Supplied Buttons above, for some reason they refuse to work correctly, and despite bringing it to Bonitasofts attention, it’s low priority.

To Show Code/Logs correctly use

< code >
your code/log
< /code >

removing the spaces to allow the showing of code/logs correctly as here:

your code/log

Thanks and regards
Seán

Thanks for your quick answer Seán.

It works flawlessly. Are there any methods to retrieve user’s custom data in a similar way? I tried fruitlessly to find them using the api documentation.

Thanks again.

Javier

In Javadocs here: http://documentation.bonitasoft.com/javadoc/api/7.3/index.html

there are lots of methods such as getCustomUserInfo which might help you,

regards
Seán