Description
Returns two properties. A count of matching records and an array containing details about a number of those records.
Parameters
Name | Type | Description |
---|---|---|
type | Object, required | See Type |
age | Object, required | See Age |
user | Object, required | See User |
state | Object, required | See State |
start | Integer, optional | The 1-based index of the first item to retrieve. Required if length is set |
length | Integer, optional | The maximum number of records to retrieve. Required if start is set |
Returns
Property | Type | Description |
---|---|---|
count | Integer | The total number of matching records |
list | Array | Information about the selected records, respecting the start and length parameters. Items are ordered by creation date. If start is greater than the number of records an empty list will be returned. Each item in the array represents one record with the following properties |
list[n].date | Object | Contains two keys, "created" and "lastUpdated". The value of each of these is an ISO date string in UTC |
list[n].id | Integer/String | The ID of the record: Workflow - The process instance ID (this is not the business key) History - The unique ID (the randomly generated ID, not the key of labels) Object - The object ID |
list[n].state | Object | Contains the key "finished" which is boolean |
list[n].type | Object | A worker specific object matching the relevant selectors described in Type |
list[n].user | Object | Contains two keys, "createdBy" which is a string (the username), and "involved" which is an array of strings (all usernames involved) |
Examples
Workflow
This example queries instances of the "chainedevents" workflow, of any age, in any state, created by user "timg". Only details of the first two records will be returned.
Request
function(params, credentials) {
var records = this.callWorkerMethod("workflow", "queryRecords", {
"type": {
"processDefinitionKey": "chainedevents"
},
"age": {
"matchAll": true
},
"user": {
"createdBy": "timg"
},
"state": {
"matchAll": true
},
"start": 1,
"length": 2
});
return records;
}
Returns
{
"jsonrpc": "2.0",
"id": 225,
"result": {
"count": 16,
"list": [{
"id": "7649",
"state": {
"finished": true
},
"type": {
"processDefinitionKey": "chainedevents",
"processDefinitionId": "chainedevents:5:7647"
},
"date": {
"created": "2017-03-07T12:03:36.280Z",
"lastUpdated": "2017-03-07T12:05:04.493Z"
},
"user": {
"involved": ["timg", "admin"],
"createdBy": "timg"
}
}, {
"id": "7671",
"state": {
"finished": true
},
"type": {
"processDefinitionKey": "chainedevents",
"processDefinitionId": "chainedevents:5:7647"
},
"date": {
"created": "2017-03-07T12:04:02.023Z",
"lastUpdated": "2017-03-07T12:05:01.120Z"
},
"user": {
"involved": ["timg"],
"createdBy": "timg"
}
}]
}
}
History
This example queries all histories that involved the supplied user, and are older than the 1st of June 2017. Only the first two records are returned.
Request
function(params, credentials) {
var records = this.callWorkerMethod("history", "queryRecords", {
"type": {
"matchAll": true
},
"age": {
"created": "2017-06-01T00:00:00.000Z"
},
"user": {
"involved": params.user
},
"state": {
"matchAll": true
},
"start": 1,
"length": 2
});
return records;
}
Returns
{
"jsonrpc": "2.0",
"id": 237,
"result": {
"count": 63,
"list": [{
"date": {
"lastUpdated": "2017-01-12T11:32:03.293Z",
"created": "2017-01-12T11:32:03.043Z"
},
"state": {
"finished": true
},
"id": "eac8ac32-2e68-4786-b9ad-9eb2e9a7091e",
"type": {
"labelD": null,
"labelE": null,
"labelA": "Online Auction",
"labelB": "3510-6280-7287-8791",
"labelC": null
},
"user": {
"involved": ["timg"],
"createdBy": "timg"
}
}, {
"date": {
"lastUpdated": "2017-01-12T11:43:40.317Z",
"created": "2017-01-12T11:36:20.517Z"
},
"state": {
"finished": true
},
"id": "09c057f6-67f0-4d97-abc1-3cb6d9b0fa9d",
"type": {
"labelD": null,
"labelE": null,
"labelA": "Online Auction",
"labelB": "4329-0864-7666-9256",
"labelC": null
},
"user": {
"involved": ["timg"],
"createdBy": "timg"
}
}]
}
}
Objects
This example queries all objects of the "FORM_QUIZANSWERS" type created before the 1st of June 2017.
Request
function(params, credentials) {
var records = this.callWorkerMethod("icmapi", "queryRecords", {
"type": {
"objectType": "FORM_QUIZANSWERS"
},
"age": {
"created": "2017-06-01T00:00:00.000Z"
},
"user": {
"matchAll": true
},
"state": {
"matchAll": true
}
});
return records;
}
Returns
{
"jsonrpc": "2.0",
"id": 240,
"result": {
"count": 5,
"list": [{
"date": {
"lastUpdated": "2017-01-12T10:50:40.103Z",
"created": "2017-01-12T10:50:40.103Z"
},
"state": {
"finished": false
},
"id": 51,
"type": {
"objectType": "FORM_QUIZANSWERS"
},
"user": {
"involved": ["TIMG"],
"createdBy": "TIMG"
}
}, {
"date": {
"lastUpdated": "2017-01-12T11:02:34.797Z",
"created": "2017-01-12T11:02:34.797Z"
},
"state": {
"finished": false
},
"id": 52,
"type": {
"objectType": "FORM_QUIZANSWERS"
},
"user": {
"involved": ["ADMIN"],
"createdBy": "ADMIN"
}
}, {
"date": {
"lastUpdated": "2017-01-12T11:05:42.303Z",
"created": "2017-01-12T11:05:42.303Z"
},
"state": {
"finished": false
},
"id": 53,
"type": {
"objectType": "FORM_QUIZANSWERS"
},
"user": {
"involved": ["BOB"],
"createdBy": "BOB"
}
}, {
"date": {
"lastUpdated": "2017-01-30T09:08:37.063Z",
"created": "2017-01-30T09:08:37.063Z"
},
"state": {
"finished": false
},
"id": 71,
"type": {
"objectType": "FORM_QUIZANSWERS"
},
"user": {
"involved": ["TIMG"],
"createdBy": "TIMG"
}
}, {
"date": {
"lastUpdated": "2017-01-30T15:13:47.920Z",
"created": "2017-01-30T15:13:47.920Z"
},
"state": {
"finished": false
},
"id": 72,
"type": {
"objectType": "FORM_QUIZANSWERS"
},
"user": {
"involved": ["TIMG"],
"createdBy": "TIMG"
}
}]
}
}