setField


Purpose

Sets a value for the key in the selected account data scope (either public or private).

If the key does not exist, it is created. If it exists, its value is overwritten.

Signature

setField( scope, key, value, callback )

Returns

This method does not return anything.

Parameters

Name Description Type Use
scope Specifies whether the data lays within the public or private scope of the account. string required 
key Identifies the exact data item that is created or updated by the setField operation. string required 
value Represents the exact value that is set for the given key. string required 
callback Passed while sending a reply to the request referring to a field. object required

Callback structure

The Field object's callback can be structured as follows:

{
	onFailure: function(error) { ... },
	onSuccess: function() { ... }
}

Methods

Name Description Return type
onFailure Indicates that a request was not processed. Passes the error object that contains two fields: code (a numeric value associated with an error) and description (the type of failure). Possible failure types are listed in the Constants table, in the AccountManager article. undefined
onSuccess Indicates that a request was successfully processed. This method does not return anything. undefined

Related topics

Public API reference
AccountManager
Legal notice | Copyright © 2018 and Confidential to Pegasystems Inc. All rights reserved
Pega Community | Feedback
Advanced...