Variables is empty for GlideRecord query record.

Rajesh73
Mega Contributor

Variables is empty for GlideRecord query record, even though it has variables.

 

	var req = new GlideRecord('sc_req_item');
	req.addQuery('sys_id','=','XXXXXXXXXXXXX');
	req.query();
while (req.next()) {
 // req.variables is empty
}
	

 

How to get the variables value ?

1 ACCEPTED SOLUTION

Rajesh73
Mega Contributor

Figured out that the value of variables is empty on client script but works fine on business script.

 

 

Prateek's solution is partially working on client script but need to query two more additional tables sc_item_option and item_option_new to get variable value and name.

 

 

Thanks for all your help.

View solution in original post

13 REPLIES 13

VigneshMC
Mega Sage

Try

 

while (req.next()) { 

req.variables.<variable_name>;

}

Because req.variables is empty, req.variables.<variable_name> is also empty.

johansec
Tera Guru
var req = new GlideRecord('sc_req_item');
req.addQuery('sys_id','xxxxxxxxxxxxx');
req.query();
while (req.next()) {
 gs.print(req.variable_pool);
}

 

req.variable_pool is undefined.