Name

sn_cimaf.CIMetricEngineUtils

Description

No description available

Script

var CIMetricEngineUtils = Class.create();
CIMetricEngineUtils.prototype = {
  initialize: function() {
  },
  
  /*
  * Returns a GlideRecord instance for the given table, positioned to the given sys_id, and of the right class (table).  This 
  * @baseTable: the name of the base table that the given sys_id is in
  * @sysId: the sys_id of the CI desired
  */
  getGR: function(baseTable, sysId) {
      // first query the base table, and bail out if we can't find it...
      var gr = new GlideRecord(baseTable);
      if (!gr.get(sysId)) {
          return null;
      }
          
      // now see what class this CI really is...
      var klass = gr.getRecordClassName();
      
      // if it's actually the base class, we're done...
      if (klass == baseTable) {
          return gr;
      }
      
      // re-query, but now using the right table, and bail out if we can't find it...
      gr = new GlideRecord(klass);
      if (!gr.get(sysId)) {
          return null;
      }

      return gr;
  },

  type: 'CIMetricEngineUtils'
};

Sys ID

7a41cf2747238590dc971c42846d431a

Offical Documentation

Official Docs: