How to read variables in variable editor in incident?

Hardik Benani
Mega Sage
Mega Sage

Is there a way to read the variable from variable editor defined on incident on update or insert business rule?

1 ACCEPTED SOLUTION

Hello,

If the issue is resolved, can you mark the answer correct. 

Thanks

 

View solution in original post

3 REPLIES 3

rad2
Mega Sage

If i am not wrong, You can access the variable

- in client scripts - current.variables.<field_name>

- in Business Rules, you can get the value from the question_answer table with the help of the table_sys_id

 

Hope this helps!

Hello,

If the issue is resolved, can you mark the answer correct. 

Thanks

 

In case someone needs similar help, I figured out based on the "question_answer", you can use below in the business rule to get the Name and value of the variables.

 

var qText = ''; 
var qName = new GlideRecord('question_answer');
qName.addQuery('table_sys_id',current.sys_id);
qName.query();
while (qName.next()) {
var answer = '';
if(qName.question.type.getChoiceValue() == 'Reference'){
var qValue = new GlideRecord(qName.question.reference);
qValue.get(qName.value);
answer = qValue.getDisplayValue();
} else {
answer = qName.value.getDisplayValue();
}
qText = qText + '\n' + qName.question.question_text + ' : ' + answer;
}