Toggle menu

deleteHistories()

Description

This function deletes histories from the database. When a history is deleted its ID and the time its was deleted are recorded in the database.

When a history is deleted, any History Digest API it forms part of is automatically updated (ie the relevant row is also deleted).

Take care when using this method. Once histories have been deleted they cannot be restored. You can test your filter by making a call to getHistories()

Versions

iCM 10.1.0.51 (released 22/08/2024) made the filter parameter required. Prior to this version, not supplying a filter would delete all histories in the database.

Parameters

NameTypeDescription
datasourceString, optionalThe name of the datasource from where histories will be deleted. This parameter overrides the same parameter in the worker configuration which in turn overrides the default datasource
filterFilter-object, requiredThe filter specifies which histories will be deleted. The syntax of filter objects relates to many methods and is explained in Filter Objects
getsqlBoolean, optionalIf this parameter is supplied and set to true then the return structure will include an element called "sql" which contains the query and the parameters which were used to retrieve the history data from the database. This option returns a large amount of data and is intended for testing and debugging
sealedBoolean, optionalIf true only histories that have been sealed will be deleted. If not supplied both sealed and non-sealed histories will be candidates for deletion.

Returns

If the deleteHistories() operation was successful then the "result" structure will contain the boolean value true.

Example

This example deletes all histories with a given labela written after a certain time.

function(params, credentials) {
    let resp = this.callWorkerMethod("history", "deleteHistories", {
        "filter": {
            "AND": [{
                "key": "labela",
                "EQ": "LoopingWorkflow"
            }, {
                "key": "created",
                "GT": 1611931464496
            }]
        }
    });
    return resp;
}

Last modified on 22 August 2024

Share this page

Facebook icon Twitter icon email icon

Print

print icon