Modify Process Instance Execution State

Submits a list of modification instructions to change a process instance's execution state. A modification instruction is one of the following:

  • Starting execution before an activity
  • Starting execution after an activity on its single outgoing sequence flow
  • Starting execution on a specific sequence flow
  • Cancelling an activity instance, transition instance, or all instances (activity or transition) for an activity

Instructions are executed immediately and in the order they are provided in this request's body. Variables can be provided with every starting instruction.

The exact semantics of modification can be read about in the user guide.

Method

POST /process-instance/{id}/modification

Parameters

Path Parameters

Name Description
id The id of the process instance to modify.

Request Body

A JSON object with the following properties:

Name Description
skipCustomListeners Skip execution listener invocation for activities that are started or ended as part of this request.
skipIoMappings Skip execution of input/output variable mappings for activities that are started or ended as part of this request.
instructions A JSON array of modification instructions. The instructions are executed in the order they are in. An instruction may have the following properties:
Name Description
type Mandatory. One of the following values: cancel, startBeforeActivity, startAfterActivity, startTransition. A cancel instruction requests cancellation of a single activity instance or all instances of one activity. A startBeforeActivity instruction requests to enter a given activity. A startAfterActivity instruction requests to execute the single outgoing sequence flow of a given activity. A startTransition instruction requests to execute a specific sequence flow.
activityId Can be used with instructions of types startBeforeActivity, startAfterActivity, and cancel. Specifies the activity the instruction targets.
transitionId Can be used with instructions of types startTransition. Specifies the sequence flow to start.
activityInstanceId Can be used with instructions of type cancel. Specifies the activity instance to cancel. Valid values are the activity instance IDs supplied by the Get Activity Instance request.
transitionInstanceId Can be used with instructions of type cancel. Specifies the transition instance to cancel. Valid values are the transition instance IDs supplied by the Get Activity Instance request.
ancestorActivityInstanceId

Can be used with instructions of type startBeforeActivity, startAfterActivity, and startTransition. Valid values are the activity instance IDs supplied by the Get Activity Instance request.

If there are multiple parent activity instances of the targeted activity, this specifies the ancestor scope in which hierarchy the activity/transition is to be instantiated.

Example: When there are two instances of a subprocess and an activity contained in the subprocess is to be started, this parameter allows to specifiy under which subprocess instance the activity should be started.

variables

Can be used with instructions of type startBeforeActivity, startAfterActivity, and startTransition. A JSON object containing variable key-value pairs. Each key is a variable name and each value a JSON variable value object.

Name Description
value The variable's value. For variables of type Object, the serialized value has to be submitted as a String value.

For variables of type File the value has to be submitted as Base64 encoded string.

type The value type of the variable.
valueInfo A JSON object containing additional, value-type-dependent properties.

For serialized variables of type Object, the following properties can be provided:

  • objectTypeName: A string representation of the object's type name.
  • serializationDataFormat: The serialization format used to store the variable.

For serialized variables of type File, the following properties can be provided:

  • filename: The name of the file. This is not the variable name but the name that will be used when downloading the file again.
  • mimetype: The MIME type of the file that is being uploaded.
  • encoding: The encoding of the file that is being uploaded.
local Indicates whether the variable should be a local variable or not. If set to true, the variable becomes a local variable of the execution entering the target activity.

annotation An arbitrary text annotation set by a user for auditing reasons.

Result

This method returns no content.

Response Codes

Code Media type Description
204 Request successful.
400 application/json At least one modification instruction misses required parameters.
500 application/json The modification cannot be performed, for example because it starts a failing activity.

Example

Request

POST /process-instance/aProcessInstanceId/modification

Request Body:

{
"skipCustomListeners": true,
"skipIoMappings": true,
"instructions": [
    {
      "type": "startBeforeActivity",
      "activityId": "activityId",
      "variables":
        {"var": {
          "value": "aVariableValue",
          "local": false,
          "type": "String"},
        "varLocal": {
          "value": "anotherVariableValue",
          "local": true,
          "type": "String"}
        }
    },
    {
      "type": "cancel",
      "activityInstanceId": "anActivityInstanceId",
    }
  ],
"annotation": "Modified to resolve an error."
}

Response

Status 204. No content.

On this Page: