Name
global.STTRMConditionSNC
Description
ServicenNow code for the STTRMCondition class
Script
var STTRMConditionSNC = Class.create();
STTRMConditionSNC.prototype = {
initialize: function(conditionGr, _gs) {
this._gr = conditionGr;
this._gs = _gs || gs;
},
evaluate: function(currentGr) {
var conditionType = this._gr.getValue("condition_type");
if (conditionType === STTRM.CONDITION_TYPE)
return GlideFilter.checkRecord(currentGr, this._gr.getValue("condition"), true);
if (conditionType === STTRM.SCRIPT_TYPE)
return new GlideScopedEvaluator().evaluateScript(this._gr, "condition_script", {"current": currentGr});
// It's a pre-defined condition type so evaluate using the class
return new STTRMConditionType(this._gr.condition_type.getRefRecord()).evaluate(currentGr);
},
getConditionTypeRefQual: function() {
// dotwalk++
var tableName = this._gr.sttrm_state_transition.from_state.sttrm_model.table_name + "";
if (!tableName)
return "table_nameISEMPTY";
var tables = [];
var tableList = GlideDBObjectManager.get().getTables(tableName);
for (var i=0; i < tableList.size(); i++)
tables.push(tableList.get(i));
return "table_nameISEMPTY^ORtable_nameIN" + tables.join(",");
},
toJS: function() {
return {
"name": this._gr.getDisplayValue("name") || "",
"description": this._gr.getDisplayValue("description") || "",
"sys_id": this._gr.getUniqueValue()
};
},
type: 'STTRMConditionSNC'
};
Sys ID
47c9e6145303101034d1ddeeff7b120d