This operation a process instance by sending a BPMN message. Use it when a message start event should create the process instance.
The base request is:
sendStartMessage()
The following example starts a process instance using a message name and business key stored in process variables:
variables.process =
new RuntimeProcessInstanceService()
.sendStartMessage({
name: variables.messageName,
businessKey: variables.businessKey
});
You can use StartMessagePayload when a script needs to start a process through a BPMN message start event. The name property must match the name of a message start event configured in the process model.
The following example starts a process instance and passes variables to the new process:
const startMessagePayload = {
name: 'startOrderProcess',
businessKey: variables.businessKey,
variables: {
priority: 'HIGH',
orderId: variables.orderId
}
};
variables.process =
new RuntimeProcessInstanceService()
.sendStartMessage(startMessagePayload);
When the runtime receives the message, it locates a matching message start event, creates a new process instance, initializes it with the supplied variables, and returns the created process instance to the script.