Name

sn_rf.RFPIWBClassificationService

Description

No description available

Script

var RFPIWBClassificationService = Class.create();
RFPIWBClassificationService.prototype = Object.extendsObject(sn_rf.RFClassificationService, {
  tableName: RFConstants.tables.PIWB_MODEL,
  limit: 1,

  initialize: function(usecaseSysId) {
      this.rfLogger = new RFLogger("RFPIWBClassificationService");
      var piwbModelGr = new GlideRecord(this.tableName);
      piwbModelGr.addQuery(RFConstants.fields.PIWB_MODEL_USECASE, usecaseSysId);
      piwbModelGr.addQuery(RFConstants.fields.PIWB_MODEL_STATUS, RFConstants.piwbModelStatus.INTEGRATED);
      piwbModelGr.addQuery(RFConstants.fields.PIWB_MODEL_CAPABILITY_VALUE, RFConstants.mlCapability.CLASSIFICATION);
      piwbModelGr.setLimit(this.limit);
      piwbModelGr.query();
      if (piwbModelGr.next()) {
          this.currentRecord = piwbModelGr;
      }
  },

  getMLModelConfig: function() {
      try {
          return JSON.parse(this.currentRecord.getValue(RFConstants.fields.PIWB_MODEL_ML_MODEL_CONFIG));
      } catch (e) {
          this.rfLogger.logError(
              'Invalid ML model configuration for PIWB model ' + this.currentRecord.getValue(RFConstants.fields.SYS_ID) +
              '. Error: ' + e);
          return {};
      }
  },

  getTable: function() {
      return this.getMLModelConfig().table;
  },

  getOutputField: function() {
      return this.getMLModelConfig().outputField;
  },

  getSolutionName: function() {
      return this.currentRecord.getValue(RFConstants.fields.PIWB_MODEL_ML_MODEL_SOLUTION_NAME);
  },

  type: 'RFPIWBClassificationService'
});

Sys ID

db0c3dd5535730107234ddeeff7b1208

Offical Documentation

Official Docs: