addAction


Purpose

Adds an action to the action queue.

This method can be called no earlier than after the getOfflineStorageCount method's onSuccess callback is invoked during the first application start. Otherwise, it fails with onFailure callback invoked.

Signature

addAction( type, handle, metadata, data, onSuccess, onFailure, options )

Returns

This method does not return anything.

Parameters

Name Description Type Use
type Denotes the type of action to be written. string optional
handle Action's handle, used in data synchronization. string optional
metadata Action's meta data. string required
data The action's data string. string required
onSuccess A callback function, informs that the operation completed successfully. The onSuccess function takes an id parameter that is used to identify the action that was just added. function required
onFailure A callback function, called when the operation fails. Returns an error code, as defined in the Constants table in the Client Store article, and an error message. function required
options A JavaScript object containing optional flags. object optional

The options object is structured as follows. It contains flags that enable action filtering in the getQueuedActionsCount and listActions methods.

{
  silent,
  lax,
  negligible
}
Name Description Type Use
silent

By setting this flag to "true" you can filter out actions from the results of the getQueuedActionsCount and listActions methods.

boolean optional
lax By setting this flag to "true" you prevent the ongoing data sync from restarting when a new action is added. boolean optional
negligible By setting this flag to "true" for all actions in the action queue you prevent the prompt for an old password from displaying when a new password is set. All actions are discarded. boolean optional

Caution

For the synchronization process to execute as designed, both metadata and data strings must contain a proper JSON object.

Related topics

Client Store
Legal notice | Copyright © 2016 and Confidential to Pegasystems Inc. All rights reserved
PDN | Hybrid Container | Feedback
Advanced...