Query the indexed task collection. Note that only active tasks are indexed, once a task has been completed it is also removed from the search index.
Parameters
| Name | Type | Description |
|---|---|---|
| useQueryService | Boolean | This should always be set to true. It is present for backwards compatibility and will be removed in a future release |
| filter | Object | Return tasks matching the provided filter |
| start | Number | (Optional) Where to start the result set from, defaults to 0 |
| limit | Number | (Optional) How many results to return defaults, to 10 |
| sortOrder | Array<Object> | (Optional) Enables multi-column ordering. For example Available sort values: Note that when sorting by |
Filter Keys
The following keys can be used when building filters to query indexed tasks.
| Name | Type | Description |
|---|---|---|
| assigned | Boolean | Only supports "false" and the "EQ" operator allows tasks to be retrieved that are not assigned to a user |
| assignee | String | The user assigned to a task |
| candidate | String | The candidate users for a task |
| candidateGroups | String | The candidate groups for a task |
| createTime | String (ISO8601) | The create time of the task |
| description | String | The task description |
| dueDate | String (ISO8601) | The due date of the task |
| processBusinessKey | String | The business key of the process the task belongs to |
| processDefinitionKey | String | The key for the process definition the task belongs to |
| processDescription | String | The expanded process description for the process the task belongs to |
| suspended | Boolean | Whether the task is part of a suspended process instance or not. If this key isn't set in a filter the default behaviour is to return both active and suspended tasks. Setting the workflow worker configuration property |
| taskDefinitionKey | String | The ID of the workflow task activity as set in the model |
Examples
See the Filters article for further examples.
Request
A basic call from an end point finding the tasks assigned to a known user.
function(params, credentials) {
let resp = this.callWorkerMethod("workflow", "getQueryTasks", {
"useQueryService": true,
"filter": {
"key": "assignee",
"EQ": "timg"
}
});
return resp;
}
Response
Note that
{
"list": [{
"processVars": {
"form_FEEDBACK": "Here's some feedback",
"form_ISSUETYPE": "Error",
"form_URL": "https://docs.gossinteractive.com/article/7747/getQueryProcesses"
},
"id": "240026",
"taskDescription": "Review feedback for https://docs.gossinteractive.com/article/7747/getQueryProcesses",
"assignee": "timg",
"candidateGroups": ["staff"],
"candidateUsers": [],
"canUnclaim": true,
"processInstanceName": "Feedback Review",
"processInstanceId": "240001",
"processDefinitionKey": "feedbackreview",
"createTime": "2022-02-18T15:08:40Z",
"dueDate": null,
"processDescription": "Review comments from the feedback form",
"businessKey": "5168-8848-3661-2384",
"parentBusinessKey": null,
"parentProcessId": null,
"suspended": false,
"taskDefinitionKey": "sid-4A8EB792-047C-44FA-9BDE-5C23E891A928"
}],
"count": 1,
"time": 5,
"debug": null
}
Request
This example has a more interesting filter and sorts the results.
function(params, credentials) {
let resp = this.callWorkerMethod("workflow", "getQueryTasks", {
"useQueryService": true,
"filter": {
"key": "candidateGroups",
"IN": [{
"EQ": "cm-feedback-manager"
},
{
"EQ": "cm-feedback"
}
]
},
"sortOrder": [{
"creationDate": "desc"
}],
"limit": 20
});
return resp;
}
Request
Finding tasks due in a particular date range.
function(params, credentials) {
let resp = this.callWorkerMethod("workflow", "getQueryTasks", {
"useQueryService": true,
"filter": {
"key": "dueDate",
"RANGE": ["2024-03-01T14:00:00Z", "2024-03-011T14:00:00Z"]
},
"sortOrder": [{
"creationDate": "desc"
}],
"limit": 20
});
return resp;
}
