In Groovy script, how can I get the case data from human task

Hi,
In my groovy script, I write a code to send email to the person that submit the initiation from (user that start the case).

I am able to get the id from the below code:

def processApi  = this.accessor.getProcessAPI()
def task = processApi.getHumanTaskInstance(this.humanTaskInstanceId)
def rootContainerId = task.getRootContainerId()
def parentContainerId = task.getParentContainerId()

However, I am unable to process further.

What I need is to get the userID from field "started_by" as in this API link:

../API/bpm/case?p=0&c=9999

Anyone have solution? Is there an API in groovy script that let me get the inormation I need?

Hi,

Since 2021.1 you can use the provided code template from the User category named processInitiatorUser:

def processInitiator = apiAccessor.getIdentityAPI().getUser(apiAccessor.getProcessAPI() .getProcessInstance(processInstanceId) .getStartedBy())

HTH
Romain