Utils

The utils object is the main object for utilities.

utils.cancelDelay(ruleName)

Cancels an active delayed action produced by another rule activation.

Returns: void

This function takes as parameter an object with the following fields:

Property Type Default Mandatory Description
ruleName String Yes Name of rule that produce delayed actions.

Example of use:

The example cancels delay of ‘highTemperatureRule’ rule.

utils.cancelDelay('highTemperatureRule');

utils.encryptString(encryptConfig)

Encrypt a value.

Returns: String

This function takes as parameter an object with the following fields:

Property Type Default Mandatory Description
originalValue String Yes The value to encrypt
datastreamId String Yes The datastream of provision type, of datamodel that define this value
organization String Yes The organization name to which the datamodel belongs

Example of use:

encryptConfig = {
    originalValue: 'text to encrypt',
    datastreamId: 'provision.data.encrypt',
    organization: 'organization_name'
}

var encryptedValue = utils.encryptString(encryptConfig);

utils.decryptString(decryptConfig)

Decrypt a value.

Returns: String

This function takes as parameter an object with the following fields:

Property Type Default Mandatory Description
encryptedValue String Yes The value to decrypt
datastreamId String Yes The datastream of provision type, of datamodel that define this value
organization String Yes The organization name to which the datamodel belongs

Example of use:

decryptConfig = {
    encryptedValue: 'text to decrypt',
    datastreamId: 'provision.data.encrypt',
    organization: 'organization_name'
}

var decryptedValue = utils.decryptString(decryptConfig);