Name
sn_rf.RFConditionalDefinitionService
Description
No description available
Script
var RFConditionalDefinitionService = Class.create();
RFConditionalDefinitionService.getBySysIds = function(sysIds) {
var conditionalDefinitions = [];
for (var i = 0; i < sysIds.length; i++) {
var conditionalDefinition = new RFConditionalDefinitionService(sysIds[i]);
if (conditionalDefinition.hasValidRecord()) {
conditionalDefinitions.push(conditionalDefinition);
}
}
return conditionalDefinitions;
};
RFConditionalDefinitionService.prototype = {
tableName: RFConstants.tables.SN_RF_CONDITIONAL_DEFINITION,
initialize: function(grOrSysId) {
if (grOrSysId && grOrSysId.sys_class_name == this.tableName && grOrSysId.isValidRecord()) {
this.currentRecord = grOrSysId;
} else {
var gr = new GlideRecord(this.tableName);
if (gr.get(grOrSysId)) {
this.currentRecord = gr;
}
}
},
hasValidRecord: function() {
return this.currentRecord && this.currentRecord.sys_class_name == this.tableName && this.currentRecord.isValidRecord();
},
getTable: function() {
return this.currentRecord.getValue(RFConstants.fields.SN_RF_CONDITIONAL_DEFINITION_TABLE);
},
getInputCondition: function() {
return this.currentRecord.getValue(RFConstants.fields.SN_RF_CONDITIONAL_DEFINITION_INPUT_CONDITION) || '';
},
getRecommendation: function() {
return JSON.parse(this.currentRecord.getValue(RFConstants.fields.SN_RF_CONDITIONAL_DEFINITION_RECOMMENDATION)) || {};
},
evaluateInputCondition: function(contextRecord) {
return GlideFilter.checkRecord(contextRecord, this.getInputCondition());
},
type: 'RFConditionalDefinitionService'
};
Sys ID
3da045c953033010e530ddeeff7b12f0