sys_id of the catalog variable to be used in reference qualifier.

Arnab2
Kilo Contributor

Hi,

I have a look up select box variable for a catalog item. It is referring to a custom table. I am using a reference qualifier to populate the choices. How can I pass the sys_id of this select box as a parameter to a script include via reference qualifier? I don't want to hard code the sys_id. Is there a way to achieve this?

Using current.sys_id will fetch me the catalog item's sys_id. I need the sys_id of the variable for which I am setting the options.

 

Thanks and regards,

Arnab Dash

9 REPLIES 9

Allen Andreas
Administrator
Administrator

Try:

current.variables.variable_name.sys_id


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi Allen,

 

Have tried it.

 

javascript:gs.log('vlog: '+current.variables.static_data_look_up.sys_id);

Output:undefined

'static_data_look_up' is the variable_name

kristenankeny
Tera Guru

Can you explain why you need the variable's information to set its filter? Are you using the same table for multiple variables on the same form?

Since the documentation online for the functions is thin, the best solution I could find was this:

var ques = current.variables.testing_ref.getGlideObject().getQuestion().getLabel();
var lookupQues = new GlideRecord('item_option_new');
lookupQues.addQuery('question_text',ques);
lookupQues.addQuery('cat_item','27ae7be1db221300205f793ebf96191e');
lookupQues.query();
if(lookupQues.next()){
gs.log(lookupQues.sys_id,'refTesting');
}