Toggle menu

getProcessInstances

Returns details of active or suspended process instances matching the specified criteria. Familiarise yourself with the Queries and Performance article before using this function.

getQueryProcesses, which uses the workflow search collection, is more performant than this function and has a range of Filters you can use to find tasks. getQueryProcesses should be your preferred choice over this function which, although still supported, primarily exists for backwards compatibility.

Parameters 

NameTypeDescription
activeBooleanDefault: true. If true, only include process instances that are currently active. If false, include suspended instances
excludeSubprocessesBooleanIf this is true, only top-level processes will be returned
firstResultNumberThe first result from the possible list of results to return (starting from 0); in conjunction with maxResults this can be used to implement paging
includeCanUnclaimBooleanIf true, include unclaimability of tasks in response 
includeCurrentTasksBooleanInclude details of any active tasks for returned process instances
includeTaskVariablesBooleanInclude task variables for active tasks
includeTaskDescriptionsBooleanInclude expanded task descriptions for active tasks (documentation field)
includeListBooleanIf false, only a count of matching results will be returned; this property is true by default
includeMessageListenersBooleanInclude details of any active message listeners in the response. Currently only supports boundary messages
includeProcessDefinitionBooleanInclude full details of the process definition uses to start the returned process instances
includeProcessDescriptionBooleanInclude the expanded process description (documentation field) in the response
includeProcessVariablesBooleanIf true, process variables will be returned for each process in the result
includeStarterDetailsBooleanInclude start time, start user ID, process definition ID
involvedUserStringOnly return process instances which have the specified involved user
maxResultsNumberThe maximum number of results to return; in conjunction with firstResult this can be used to implement paging. Defaults to 5000 if not set
orderByProcessDefinitionId"asc" or "desc"Order results by process definition ID
orderByProcessDefinitionKey"asc" or "desc"Order results by process definition key
orderByProcessInstanceId"asc" or "desc"Order results by process instance ID (note that the process instance ID is represented as a string so 77 will appear after 100)
processDefinitionIdStringOnly return processes with the specified process definition ID
processDefinitionKey           StringOnly return processes with the specified process definition key
processDefinitionNameStringOnly return processes with the specified process definition name
processInstanceBusinessKeyStringOnly return process instances which have the specified business key
processInstanceIdStringOnly return the process instances which has the specified ID
processInstanceIdsArray<String>Only return process instances which have one of the specified process instance IDs
sortOrderArray<Object>Enables multi-column ordering using the "orderBy" parameters above. For example, [{" processDefinitionKey ":"desc"},{" processInstanceId ":"asc"}] . The available field names are:
ProcessDefinitionId
ProcessDefinitionKey
ProcessInstanceId
subProcessInstanceIdStringReturn only the process instance that is the immediate superprocess of the specified process instance ID
superProcessInstanceIdStringOnly return process instances which are subprocesses of the specified process ID
suspendedBooleanIf true, only return processes which are currently suspended
variableNameString

These parameters are used together to only return instances that have a variable with a value that meets the set condition, eg a variable called "name" with a value that equals "Tim".

variableName specifies a process variable name
variableValue specifies a value
variableCondition specifies a condition, valid values for variableCondition are "equals", "equalsIgnoreCase", "greaterThan", "greaterThanOrEqual", "lessThan", "lessThanOrEqual", "like" and "notEquals"

variableValueString/Number
variableConditionString
All parameters are optional but note that as there are no filters by default a very large results set may be generated if there are no restrictions specified in the query

Example Request

this.callWorkerMethod("workflow", "getProcessInstances",{
    "active":true,
    "includeStarterDetails":true
});

Response

{
    "jsonrpc": "2.0",
    "id": 134,
    "result": {
        "count": 1,
        "list": [{
            "businessKey": null,
            "isSuspended": false,
            "processVariables": {},
            "processDefinition": {
                "id": "anactiveprocess:1:2509",
                "formProperties": {},
                "category": "http://www.gossinteractive.com/processdef",
                "diagramResourceName": "an active process-V-1.anactiveprocess.png",
                "description": "Starts on a timer and last for a long time",
                "isSuspended": false,
                "name": "an active process",
                "identityLinks": [],
                "deploymentId": "2506",
                "resourceName": "an active process-V-1.bpmn20.xml",
                "key": "anactiveprocess",
                "version": 1
            },
            "activityId": null,
            "id": "2511",
            "startTime": "2017-02-01T15:44:14Z",
            "startUserId": null,
            "parentId": null,
            "isEnded": false,
            "processInstanceId": "2511",
            "rawFormData": {},
            "processDefinitionId": "anactiveprocess:1:2509"
        }]
    }
}

Last modified on July 29, 2024

Share this page

Facebook icon Twitter icon email icon

Print

print icon