rbf_getFields()

Warning: Support for using this method with external objects (such as those mapped to external tables, to OpenEdge Service objects, or through a HDP connection) is a beta feature. This method is supported in production systems, except for external objects.

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.

Note:

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 true, or if not specified, a date value is returned as a Date object. If false, a date value is returned as a String.

options

An optional JSON object that sets the values of optional arguments. The properties that this object can take are as follows:

  • langCode to a valid two-letter ISO language code, for example, {"langCode":"es"}
  • useISODateFormat to 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 2018 its equivalent ISO formatted value 2018-07-29T18:31:00Z- is returned.
    • If the date value is Mon Jul 30 2018, its equivalent ISO formatted value 2018-07-30 is returned.

Note:
  • 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"});