Hello,
How can I get in groovy script list of all users who participated in the flow?
I need it to send at the end of the process e-mail to all people who participated in the flow.
Thanks
**• Use a Local Data variable in the task
• Use a groovy connector to calculate the URL
• Use the variable in the Email content
• Script used:
**
import org.bonitasoft.engine.api.ProcessAPI
import org.bonitasoft.engine.bpm.flownode.ActivityInstance
import org.bonitasoft.engine.bpm.process.ProcessDefinition
ProcessAPI processAPI= apiAccessor.getProcessAPI();
ProcessDefinition processDefinition = processAPI.getProcessDefinition( processDefinitionId);
ActivityInstance activity = processAPI.getActivityInstance( activityInstanceId);
return new StringBuffer(“URL: <a href="”)
.append(“http://”)
.append( bonitaServerHost)
.append(“:”)
.append( bonitaServerPort)
.append(“/bonita/portal/resource/taskInstance/”)
.append(processDefinition.getName())
.append(“/”)
.append(processDefinition.getVersion())
.append(“/”)
.append(activity.getName())
.append(“/content/?id=”)
.append(activityInstanceId)
.append(“">here”)
.toString();
**How to send email to users?
**In front of each Human tasks, you can add a Groovy Connector to generate the URL, then a Email Connector to send the email.
You can save time using the “save configuration” in the Connector, and use this configuration when you have a new Human Task
Repost the code of @wieland.kublun_13637
import org.bonitasoft.engine.api.ProcessAPI
import org.bonitasoft.engine.bpm.flownode.ActivityInstance
import org.bonitasoft.engine.bpm.process.ProcessDefinition
ProcessAPI processAPI= apiAccessor.getProcessAPI();
ProcessDefinition processDefinition = processAPI.getProcessDefinition( processDefinitionId);
ActivityInstance activity = processAPI.getActivityInstance( activityInstanceId);
return new StringBuffer(“URL: <a href="”)
.append(“http://”)
.append( bonitaServerHost)
.append(“:”)
.append( bonitaServerPort)
.append(“/bonita/portal/resource/taskInstance/”)
.append(processDefinition.getName())
.append(“/”)
.append(processDefinition.getVersion())
.append(“/”)
.append(activity.getName())
.append(“/content/?id=”)
.append(activityInstanceId)
.append(“">here”)
.toString();