GlideRecord getRelatedRecords method not documented

gtke
Tera Contributor

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?

9 REPLIES 9

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.


Mike Moody
Kilo Guru

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.


Awesome find, Mike!


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


sorry I can't open the below link,can you give me some image or information for the method 'SNC.CMDBUtil.getRelatedRecords(5 arguments)'?

http://wiki.servicenow.com/index.php?title=CMDBUtil_API