How to get input value of variable from question_answer table?

____39
Tera Contributor

Hi,

I need to look up question_answer table and use variables value, How to get input value of variable from question_answer table? Thank you!

3 REPLIES 3

Chetan Mahajan
Kilo Sage
Kilo Sage

Hi ,

value field is not a reference field here. It is just a string field to hold value. To get the display value use this example code as below:

 

var values = new GlideRecord('question_answer');
values.addQuery('table_sys_id','30df36a1dbf3b30066c117803996196e');
values.query();
gs.log('values'+values,"values");
while(values.next())
{
if(values.value)
{

//// you can pass dynamic table value like var table_name = values.getValue('table_name'); or pass direct table name if you know like sys_user

var gr = new GlideRecord('sys_user');  

gr.addQuery('sys_id',values.value);

gr.query();

if(gr.next()){

gs.print(gr.name);
}

}

}

 Kindly mark correct and helpful if applicable

Hi ,when I submit a request form record producer, how to know it's table_sys_id, and use this table_sys_id to query? Than you!

you can get table name by sc_item_produced_record by passing current.sys_id(record producer sys_id)