rbf_getRelatedFields2()

Purpose

This function retrieves the values of the selected fields for records related to a selected Platform record.

For fields that allow values in multiple languages, you can specify the language in which to return values in the options parameter. If the values are not available in the specified language, it will return the values for the tenant's base language. If the specified language is not configured for the tenant, it will throw an error. To use the options parameter, you must set a value for useLegacyDateFormat.

The current user must have View permission on the selected object type to run this API.

Syntax

rbf_getRelatedFields2(relName, objName, id, fieldName, callback, useLegacyDateFormat, options)

Parameters

relName

The integration name of selected Relationship definition

objName

The integration name of selected Object definition

id

The ID of selected Object record

fieldName

The integration name of Field to retrieve (for related records)

callback

A callback function that will receive parameters: relName, id, an array of received values (one value per related record).

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 field "amount" from related records and makes these values available for computations:

function my_callback(relName, objId, values) {
      for (var i=0; i<values.length; i++) {
        var amount = values[i];
        // Do something...
      }
}
        
rbf_getRelatedFields2("R12345", "obj1", id, "amount ", my_callback);