createProcessInstance($startEvent, $name)
Creates and initializes a new process instance based on a start event. The function initializes a new process instance with the provided StartEvent and sets its name. The process instance can be initialized with either a given name or will use a default name if none is provided.
| Process name | Type | Type Description | Mandatory | Default |
|---|---|---|---|---|
| startEvent | Start Event | The start event object used to initialize the process. | Yes | - |
| name | Character string | Name for the new process instance. | no | "newProcessInstance" |
Type: ProcessExecution
Returns the created and initialized process instance. If the workflow is not found or no StartEvent exists, null is returned.
// Creates a process instance for the given StartEvent
createProcessInstance($startEvent)
// Creates a process instance for the given StartEvent with a specific name
createProcessInstance($startEvent, "Ticket-001")