rbf_getFields()
Purpose
This function retrieves the values of specified fields for a selected
Platform record. It brings information back to the
page using the asynchronous AJAX mechanism. For fields that contain values for different
languages, pass a langCode value in the options parameter to get the values in a specific
language. If the field does not allow multiple languages, or if there is no value for the
specified language, the value is returned in the tenant's base language.
To use the options parameter, it
is mandatory to specify a value for useLegacyDateFormat. If the specified language code is not configured
for the tenant, an error will be thrown.
The current user must have View permission on the selected object type to run this API.
Syntax
rbf_getFields(objName, id, fields, callback,
useLegacyDateFormat, options)
Parameters
objName
The object integration name.
id
ID of the selected record
fields
A comma-separated list of field integration names
callback
A callback function that will receive parameters: objName,
id, an array of received values, which can be accessed using field's
integration name as a key (see example below).
useLegacyDateFormat
This optional parameter only applies to JSON output and, specifically, to Date and Date/Time fields. If
options
An optional JSON object that sets the values of optional arguments. The properties that this object can take are as follows:
langCodeto a valid two-letter ISO language code, for example,{"langCode":"es"}useISODateFormatto get the date or date/time values in ISO format, for example,{"useISODateFormat":true}.- If the date and time value is
Mon Jul 30 00:01:00 IST 2018its equivalent ISO formatted value2018-07-29T18:31:00Z-is returned. - If the date value is
Mon Jul 30 2018, its equivalent ISO formatted value2018-07-30is returned.
- If the date and time value is
- This API is supported in portals as well.
- If both useLegacyDateFormat and
useISODateFormat are set to
true, useISODateFormat is applied.
Example
The following example reads two fields from a record in Spanish:
function my_callback(objName, objId, values) {
console.log("Record name is " + values["name"] + ". Country is " + values["country"]);
}
rbf_getFields("room", id, "name,country", my_callback, true, {"langCode":"es"});