GlideRecordUtil - getGR(String baseTable, String sys_id)

Returns a GlideRecord instance for the given table, positioned to the given sys_id, and of the right class (table).

This method is useful when you need to load a GlideRecord from a sys_id, but you don't know what the actual table is (because it may be extended from the base table). This method always returns a GlideRecord of the correct type base_table: the name of the base table that the specified sys_id is in.

Table 1. Parameters
Name Type Description
baseTable String The name of the base table containing the sys_id.
sys_id String The sys_id of the desired record.
Table 2. Returns
Type Description
GlideRecord The GlideRecord for the specified sys_id.

var gr = new GlideRecordUtil().getGR("cmdb_ci_computer", "2dfd7c8437201000deeabfc8bcbe5d56");