Skip to content

bpm/process

Documentation

Overview

Classes

BpmnError

Process

start()

Starts a new process instance for a given process definition key.

ts
static start(key: string, businessKey: string, parameters: any): string;
ParameterTypeDescription
keystringThe process definition key (ID) of the process to start.
businessKeystringAn optional business key to associate with the process instance. Defaults to an empty string.
parametersanyAn optional map of process variables to pass to the process instance upon starting. Defaults to an empty object.

Returns

  • Type: string
  • Description: The unique ID of the newly started process instance.

setProcessInstanceName()

Sets a human-readable name for an existing process instance.

ts
static setProcessInstanceName(processInstanceId: string, name: string): void;
ParameterTypeDescription
processInstanceIdstringThe ID of the process instance to update.
namestringThe new name for the process instance.

Returns

  • Type: void
  • Description:

updateBusinessKey()

Updates the business key of an existing process instance.

ts
static updateBusinessKey(processInstanceId: string, businessKey: string): void;
ParameterTypeDescription
processInstanceIdstringThe ID of the process instance to update.
businessKeystringThe new business key.

Returns

  • Type: void
  • Description:

updateBusinessStatus()

Updates the business status of an existing process instance.

ts
static updateBusinessStatus(processInstanceId: string, businessStatus: string): void;
ParameterTypeDescription
processInstanceIdstringThe ID of the process instance to update.
businessStatusstringThe new business status.

Returns

  • Type: void
  • Description:

getVariable()

Retrieves the value of a specific variable from a process instance.

ts
static getVariable(processInstanceId: string, variableName: string): any;
ParameterTypeDescription
processInstanceIdstringThe ID of the process instance.
variableNamestringThe name of the variable to retrieve.

Returns

  • Type: any
  • Description: The value of the variable, or `null` if the variable does not exist. The type is `any` as it depends on the stored value.

getVariables()

Retrieves all variables associated with a process instance.

ts
static getVariables(processInstanceId: string): any;
ParameterTypeDescription
processInstanceIdstringThe ID of the process instance.

Returns

  • Type: any
  • Description: An object containing all variables for the process instance, where keys are variable names and values are the variable values.

setVariable()

Sets or updates the value of a variable in a process instance.

ts
static setVariable(processInstanceId: string, variableName: string, value: any): void;
ParameterTypeDescription
processInstanceIdstringThe ID of the process instance.
variableNamestringThe name of the variable to set.
valueanyThe new value for the variable. The type is `any` to accommodate different data types.

Returns

  • Type: void
  • Description:

removeVariable()

Removes a variable from a process instance.

ts
static removeVariable(processInstanceId: string, variableName: string): void;
ParameterTypeDescription
processInstanceIdstringThe ID of the process instance.
variableNamestringThe name of the variable to remove.

Returns

  • Type: void
  • Description:

correlateMessageEvent()

Correlates a message event with a running process instance.

ts
static correlateMessageEvent(processInstanceId: string, messageName: string, variables: Map): void;
ParameterTypeDescription
processInstanceIdstringThe ID of the process instance to correlate the message to.
messageNamestringThe name of the message event defined in the BPMN process.
variablesMapA map of variables (`Map<string, any>`) to pass along with the message event.

Returns

  • Type: void
  • Description:

getExecutionContext()

Retrieves the current execution context object, typically used within an execution listener or service task.

ts
static getExecutionContext(): ExecutionContext;

Returns

  • Type: ExecutionContext
  • Description: A new instance of the `ExecutionContext` containing details about the current process execution path.

getTaskContext()

Retrieves the current task context object, typically used within a task listener or service task.

ts
static getTaskContext(): TaskContext;

Returns

  • Type: TaskContext
  • Description: A new instance of the `TaskContext` containing details about the current task.