Skip to content

Utils

The JS Utils object can be used in user customizable scripts within CYBERQUEST Data Transformation Service (DTS) and in Alerts. This Object can be called using subobjects, such as:

moment

This object manipulates date and time related information. Click this link for more information.

recursiveCleanupObjectProperties

This method takes an object and recursively goes through all the objects or arrays that it contains, renaming all the keys such that the @ and : symbols are replaced with _. This way, the keys will present a cleaner format.

Parameters: inputObject

Usage:

CQ.Utils.recursiveCleanupObjectProperties(inputText);

LocalStorage

The class is designed to make temporary data persist. It also acts as a caching module. (key->value)

set

Keeps a value in the local storage under a certain key. Optionally, expiring time can be specified in seconds.

Parameters:

  • listName
  • name
  • value
  • ttl (900 by default, -1 is indefinitely)

Usage:

CQ.Utils.LocalStorage.set(listName, keyName, value);

get

Returns a stored value. If the value does not exist, it will return an empty object in order to simplify the validation checks.

Parameters:

  • listName
  • name

Usage:

CQ.Utils.LocalStorage.get(listName, keyName);

erase

Deletes a single value from the local storage.

Parameters:

  • listName
  • name

Usage:

CQ.Utils.LocalStorage.erase(listName, keyName);

clear

Deletes all values from the local storage.

Parameters:

  • listName

Usage:

CQ.Utils.LocalStorage.clear(listName);

removeKeysStartingWith

Deletes from local storage all values with keys that start with a certain string.

Parameters:

  • listName
  • name

Usage:

CQ.Utils.LocalStorage.removeKeysStartingWith(listName, name);