How to get input value of variable from question_answer table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2022 08:26 PM
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!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2022 08:29 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2022 08:38 PM
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!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2022 08:55 PM
you can get table name by sc_item_produced_record by passing current.sys_id(record producer sys_id)