rbv_api.getRelatedIds2()
Purpose
For external objects (such as those mapped to external tables, to OpenEdge Service objects, or through a HDP connection), returns an array of related IDs for a specified relationship and record ID.
Syntax
rbv_api.getRelatedIds2(relName, objName, Id)
Parameters
relName
Integration name of the relationship.
ObjName
Integration name of the object.
Id
Record ID from one side of the relationship.
Return value
Returns an array of IDs for records related through the specified relationship.
-
If related records exist, the array contains one or more record IDs.
-
If no related records exist, the method may return an empty array.
Example
Retrieve the IDs of records related through a specified relationship.
var arr = rbv_api.getRelatedIds2("R1321", "ex_group", "{!#UID}");rbv_api.printArr(arr);
Example: Handling Empty Results
The following example checks whether any related records were returned.
var arr = rbv_api.getRelatedIds2("R1321", "ex_group", "{!#UID}");if (arr.length === 0) {rbv_api.println("No related records found.");}
else {rbv_api.printArr(arr);
}
Example: Handling Exceptions
The following example demonstrates how to handle errors that may occur when the relationship name, object name, or record ID is invalid.
try {var arr = rbv_api.getRelatedIds2("R1321", "ex_group", "{!#UID}");if (arr.length === 0) {rbv_api.println("No related records found.");}
}
catch (e) {rbv_api.println("Unable to retrieve related records: " + e);}