Description
Deletes all records matching the supplied selectors. Returns a count of those purged.
Parameters
All are required.
Name | Type | Description |
---|---|---|
type | Object | See Type |
age | Object | See Age |
user | Object | See User |
state | Object | See State |
Returns
Property | Type | Description |
---|---|---|
recordsPurged | integer | The number of records deleted |
Examples
Workflow
This example purges all workflow instances older than three months, in any state, that the supplied user interacted with in some way.
Request
function(params, credentials) {
var records = this.callWorkerMethod("workflow", "purgeRecords", {
"type": {
"matchAll": true
},
"age": {
"created": "P3M"
},
"user": {
"involved": params.user
},
"state": {
"matchAll": true
}
});
return records;
}
Returns
{
"jsonrpc": "2.0",
"id": 241,
"result": {
"recordsPurged": 95
}
}
History
This example deletes histories that involved the supplied user, have a labela of "Online Auction" and are sealed. labelC is set as null so that any histories that have a value for labelc, like reporting or audit (following our reporting conventions described in Labelc Histories and Reporting Data) are excluded.
Request
function(params, credentials) {
var records = this.callWorkerMethod("history", "purgeRecords", {
"type": {
"labelA": "Online Auction",
"labelC": null
},
"age": {
"matchAll": true
},
"user": {
"involved": params.user
},
"state": {
"finished": true
}
});
return records;
}
Returns
{
"jsonrpc": "2.0",
"id": 242,
"result": {
"recordsPurged": 16
}
}
Objects
This example deletes objects of any type, created by the supplied user, that haven't been updated in the last three months.
Request
function(params, credentials) {
var records = this.callWorkerMethod("icmapi", "purgeRecords", {
"type": {
"matchAll": true
},
"age": {
"lastUpdated": "P3M"
},
"user": {
"createdBy": params.user
},
"state": {
"finished": false
}
});
return records;
}
Returns
{
"jsonrpc": "2.0",
"id": 243,
"result": {
"recordsPurged": 11
}
}