GlideRecord getRelatedRecords method not documented
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2013 01:17 PM
I am trying to refer to a record in a related list via a script in a workflow. In the Script Action form I have the option to use a getRelatedRecords(String, String) method. However, this method is not documented in the wiki nor can I find any information about it online. Is this method supported? Should I use getRelatedLists() and then query the returned table instead?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2014 10:19 AM
var al = SNC.CMDBUtil.getRelatedRecords(value, "", "cmdb_ci", "cmdb_ci", "child"); // returns ArrayList
value = sys_id of a cmdb_ci record
My guess for parameters 3 and 4 are maybe source/destination tables.
I have no idea what parameters 2 and 5 do.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2014 10:30 AM
There actually appears to be a Global Business Rule for this function which is pretty self explanatory if you look at it:
function getRelatedRecords(table, field, value, target) {
gs.log("Get Related: " + table + "-" + field + "-" + value + "-" + target);
if (table == 'cmdb_ci')
return getRelatedCI(table, value);
if (target = 'sys_user_group')
return getRelatedGroup(value);
return new Array();
}
It appears that it is only designed to work with the 'cmdb_ci' table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2014 08:27 AM
Awesome find, Mike!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2015 05:05 AM
Hi Michael,
SNC.CMDBUtil.getRelatedRecords(value, "", "cmdb_ci", "cmdb_ci", "child")
I dont think the above statement is calling the global business rule (getRelatedRecords) because the function call in the above statement is passing 5 arguments to the function where as the global business rule contains only 4 arguments(table,field,value,target).
SNC.CMDBUtil is an API for which we dont have documentation for getRelatedRecords method. Please find documentation for some of the methods at http://wiki.servicenow.com/index.php?title=CMDBUtil_API
Regards,
Mamatha Thaluri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2022 04:26 AM
sorry I can't open the below link,can you give me some image or information for the method 'SNC.CMDBUtil.getRelatedRecords(5 arguments)'?