getField

The getField command can be used to retrieve a specific field out of a certain section. Click here to view the getField command in the GPP specification.

By default, Sourcepoint will set the respective U.S. State privacy section for each of the following U.S. states that are added to the framework territories of a property's vendor list: California, Colorado, Connecticut, Utah, and Virginia. The U.S. National Privacy section will be set for all other U.S. states added to the framework territories of a property's vendor list.

🚧

U.S. National Privacy Section

Please note there is currently a discrepancy between the documented client side API prefix for all sections in the GPP specification and how it is implemented via the GPP stub file. In order to ensure your commands execute successfully, the articles in this section will utilize the API prefixes as it is implemented via the GPP stub file until the discrepancy is remedied.


Command

__gpp('getField', (data,success)=>{console.log("getField successfully executed:" + success);console.log("Value for specified field is: " + data}, 'APIPrefix.fieldName');
function getField_fn(data, success) {
  console.log("getField successfully executed: " + success);
  console.log("Value for the specified field is: " + data);
}

...

__gpp('getField', getField_fn, 'APIPrefix.fieldName')

👍

Example

A request in the browser console to retrieve the value of the SharingNotice field of the U.S. National Privacy section would be called via:

__gpp('getField', (data,success)=>{console.log("getField successfully executed:" + success); console.log("Value for specified field is: " + data)}, 'usnatv1.SharingNotice');

Response

A successful getField request will return true for the success parameter and the value of the requested field for the data parameter.

The data parameter may be null for fields in sections that don't allow accessing the section data object outside an event handler. It may also be null when the CMP is not yet loaded.