ServiceNow Get Variable Name in Business Rule (Record Producer or Service Request)
current.variables.<variable_name>
for a record producer where you don't know the variable names this type of approach could work:
/*var producerVars_allVars = new GlideRecord('question_answer');
producerVars_allVars.addQuery('table_sys_id', current.sys_id);
producerVars_allVars.addQuery('question.type', '!=', 11);
producerVars_allVars.addQuery('question.type', '!=', 19);
producerVars_allVars.addQuery('question.type', '!=', 20);
producerVars_allVars.query();
while (producerVars_allVars.next()) {
var varName = producerVars_allVars.question.name.toString();
if (!gs.nil(varName)) {
if (varName == 'business_role_iga') {
sDescr += '\n';
sDescr += 'varName';
sDescr += ': '
sDescr += producerVars_allVars.value;
}
}
//allVars.push(producerVars.question.name.toString());
}*/
Comments
Post a Comment