ProcessInstanceId groovy script

I am tryting to retrieve a particular id of the person who has started a process with the code below.
id=apiAccessor.processAPI.getProcessInstance(processInstanceId).startedBy

I get an error as shown below.

org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: Declared return type class java.lang.Long is not compatible with evaluated type class java.lang.Integer for expression processInstanceId

Any Idea of how i can resolve this?

Regards.
A.

Hello,

Something like this works perfectly well :

long userID = processAPI.getProcessInstance(processInstanceId).startedBy
(do not forget the type long)

Also, check the “return type” at the bottom of the Groovy Script Editor window.
Set it to the type you want to return for this variable or script.

Regards,
Raphaël.

Thanks Raphael. It does work.
But in some cases, i cant change the return type.By default it is java.lang.string.

Regards
A.

Do not forget to mark the topic as resolved on my answer.

:slight_smile: