Toggle menu

getHistoricProcessInstances

Returns historic and current process information.

Note that query results will include currently running processes unless finished=true is set.

Familiarise yourself with the Queries and Performance article before using this function.

Parameters

NameTypeDescription
excludeSubprocessesBooleanIf this is true, only top-level processes will be returned
finishedBooleanIf this is not specified, both active and completed processes will be returned, if false only active processes will be returned, if true only completed 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
finishedAfterDateIf specified, only processes that completed after the supplied date will be returned
finishedBeforeDateIf specified, only processes that completed before the supplied date will be returned
includeListBooleanIf false, only a count of matching results will be returned; this property is true by default
includeCurrentTasksBooleanInclude details of any active tasks for returned process instances 
includeMessageListenersBooleanInclude details of any active message listeners in the response. Currently only supports boundary messages
includeProcessDefinitionBooleanInclude full details of the process definition used to start returned process instances
includeProcessDescriptionBooleanInclude the expanded process description (documentation field) in the response
includeProcessVariablesBooleanIf true, all process variables will be returned for each process instance in the result. This is potentially a very expensive operation. If you know the names of the variables you require, set the variableList parameter instead (when using variableList, do not set this parameter)
includeTaskDescriptionsBooleanInclude expanded task description (documentation field)
includeTaskVariablesBooleanInclude task local variables
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
orderByProcessInstanceBusinessKey"asc" or "desc"Order results by business key
orderByProcessInstanceDuration"asc" or "desc"Order results by time since process was started
orderByProcessInstanceEndTime"asc" or "desc"Order results by date/time process was completed
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)
orderByProcessInstanceStartTime"asc" or "desc"Order results by the date/time the process was started
processDefinitionIdStringOnly return processes with the specified process definition ID
processDefinitionKeyStringOnly return processes with the specified process definition key
processDefinitionKeyInList<String>Only return process instances that have a process definition key included in the supplied list
processDefinitionKeyNotInArray<String>Only return processes which do not have a process definition with one of the specified keys
processInstanceBusinessKeyStringOnly return process instances which have the specified business key
processInstanceBusinessKeysArray<String>Only return process instances that have a business key in the supplied array
processInstanceIdStringOnly return the process instance which has the specified process instance 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
ProcessInstanceBusinessKey
ProcessInstanceDuration
ProcessInstanceEndTime
ProcessInstanceId
ProcessInstanceStartTime
startedAfterDateOnly return process instances which were started after the specified date
startedBeforeDateOnly return process instances which were started before the specified date
startedBy (startedByUser can also be used in 1.2.3 or later)StringOnly return process instances which were started by the specified user
superProcessInstanceIdStringOnly return process instances which are subprocesses of the specified process ID
unfinishedBooleanIf true, only return processes that are unfinished, if false only return processes that are finished
variableNameStringThese 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
variableListArray<string>Only return the named process variables. We recommend using this parameter rather than includeProcessVariables (which returns all variables). Only include one of variableList or includeProcessVariables, setting both will return no results
withoutVariableAllArray<string>The returned instances must not have one of these named variables. The more variables you name the broader your exclude list becomes, meaning fewer instances will be returned. An empty array returns all instances
withoutVariableAnyArray<string>The returned instances must not have these named variables. The more variables you name the more specific your exclude list becomes, meaning more instances will be returned. An empty array returns no instances
withVariableAllArray<string>The returned instances must have all of these named variables. The more variables you name the more specific your filter becomes, meaning fewer instances are returned. An empty array returns all instances
withVariableAnyArray<string>The returned instances must have at least one of the named variables. The more variables you name the broader your filter becomes, meaning more instances will be returned. An empty array returns no instances
withTaskAssignedUserString<username>Only return instances that have tasks assigned to the supplied user. This will only ever return active process instances
withTaskCandidateUserString<username>Only return instances that have tasks that the supplied user can claim. This will only ever return active process instances. Once a task has been claimed the instance will not be returned by this query
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

Examples

Requesting All Variables

this.callWorkerMethod("workflow", "getHistoricProcessInstances",{
    "processInstanceBusinessKey":"3835-6145-6689-1424",
    "includeProcessVariables": true
});

Response

{
    "jsonrpc": "2.0",
    "id": 53,
    "result": {
        "count": 1,
        "list": [{
            "startUserId": "anonymous",
            "startTime": "2018-03-28T14:09:26Z",
            "id": "66132",
            "businessKey": "3835-6145-6689-1424",
            "processDefinitionName": "labelc histories",
            "processVariables": {
                "DELETEDATE": "20181212",
                "form_NOTES": "t",
                "APICALLERROR": "",
                "_startForm": "FORMTOSTARTASIMPLEPROCESS",
                "_initiatorProxy": "",
                "form_FILEUPLOAD": "file/6B6F8CB1-7B1A-4A0D-95B8-0A41C83B0219/thumbmaplepresleaf.png",
                "_processDefinitionID": "labelchistories:21:66086",
                "_startPageURL": "http://timssite/testform",
                "_ReviewTask_claimed": {
                    "taskId": "66160",
                    "time": "2018-03-28T14:10:20Z",
                    "user": "timg",
                    "proxyUser": ""
                },
                "form_TEXT1": "test",
                "_startDate": "2018-03-28T14:09:26Z",
                "_ReviewTask_completed": {
                    "taskId": "66160",
                    "time": "2018-03-28T14:10:29Z",
                    "user": "timg",
                    "proxyUser": ""
                },
                "STARTDATE": "2018-03-28T14:09:26Z",
                "initiator": "anonymous",
                "_fileReferences": {
                    "form_FILEUPLOAD": [{
                        "id": "6B6F8CB1-7B1A-4A0D-95B8-0A41C83B0219",
                        "filename": "thumbmaplepresleaf.png"
                    }]
                },
                "form_RADIOGROUP": "Yes",
                "_startDateString": "2018-03-28 15:09:26",
                "_businessKey": "3835-6145-6689-1424",
                "_summaryForm": "FORMTOSTARTASIMPLEPROCESS",
                "_processDefinitionKey": "labelchistories",
                "APICALLRESULT": {
                    "eventpos": 1,
                    "historyid": "428c8828-2fd7-4d83-af08-146b618b19dd",
                    "eventid": 2888
                }
            },
            "endTime": "2018-03-28T14:10:29Z",
            "processDefinitionId": "labelchistories:21:66086"
        }]
    }
}

Requesting Named Variables

this.callWorkerMethod("workflow", "getHistoricProcessInstances", {
    "processInstanceBusinessKey": "3835-6145-6689-1424",
    "variableList": ["form_TEXT1", "initiator"]
});

Response

{
    "jsonrpc": "2.0",
    "id": 54,
    "result": {
        "count": 1,
        "list": [{
            "startUserId": "anonymous",
            "startTime": "2018-03-28T14:09:26Z",
            "id": "66132",
            "businessKey": "3835-6145-6689-1424",
            "processDefinitionName": "labelc histories",
            "processVariables": {
                "form_TEXT1": "test",
                "initiator": "anonymous"
            },
            "endTime": "2018-03-28T14:10:29Z",
            "processDefinitionId": "labelchistories:21:66086"
        }]
    }
}

Last modified on October 05, 2023

Share this page

Facebook icon Twitter icon email icon

Print

print icon