Name

global.OneAPIFeatureProviderRefQualUtils

Description

This util class is used to limit the sys_metadata records that can be selected from when creating/editing a one_api_feature_provider record. Currently it restricts the selectable sys_metadata records to either sys_hub_action_type_definition, sys_hub_flow, or both.

Script

var OneAPIFeatureProviderRefQualUtils = Class.create();
OneAPIFeatureProviderRefQualUtils.prototype = {
  initialize: function() {
  	this._FDIH_ACTION_TABLE = 'sys_hub_action_type_definition';
  	this._FDIH_SUBFLOW_TABLE = 'sys_hub_flow';
  	this._SYS_SCRIPT_INCLUDE = 'sys_script_include';
  },

  getRefQualForDocumentId: function(current) {
      if (current && 'FDIH Action' == current.type) {
          return 'sys_idIN' + this._getSysIds(this._FDIH_ACTION_TABLE);
      } else if (current && 'FDIH Subflow' == current.type) {
          return 'sys_idIN' + this._getSysIds(this._FDIH_SUBFLOW_TABLE);
      } else if (current && 'script' == current.type) {
  		return 'sys_idIN' + this._getSysIds(this._SYS_SCRIPT_INCLUDE);
  	}
      return 'sys_idIN' +
          this._getSysIds(this._FDIH_ACTION_TABLE) +
  		this._getSysIds(this._SYS_SCRIPT_INCLUDE) +
          this._getSysIds(this._FDIH_SUBFLOW_TABLE);
  },

  _getSysIds: function(tableName) {
      var gr = new GlideRecord(tableName);
      gr.addActiveQuery();
      gr.query();
      var ids = [];
      while (gr.next()) {
          ids.push(new String(gr.sys_id));
      }
      return ids;
  },

  type: 'OneAPIFeatureProviderRefQualUtils'
};

Sys ID

ff54accbeb820110d9b201c7c1522839

Offical Documentation

Official Docs: