Access Type of Catalog Variable in Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2023 03:25 PM
Hi there,
So I am currently trying to access the type of catalog variable but had no luck so far.
Specifically I am trying to see if the variable is either lookup variable or not.
I have tried multiple versions like this:
current.variables.project_name.type.getDisplayValue();
current.variables.project_name.type;
Please let me know if there is a way to access the type. Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2023 07:25 PM
I think you need to use alert(typeof(g_form.variables.project_name));
typeof() is the syntax to findout the type.
Please mark correct if my response has solved your query.
Cheers,
Mohammed Basheer Ahmed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2023 07:55 PM
You can query in the variable(item_option_new) table
var rec = new GlideRecord('item_option_new');
rec.addQuery('name','project_name');
rec.addQuery('cat_item','your item');
rec.query();
rec.next();
var type = rec.type;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2023 08:58 PM
@Prathamjeet Sin ,
Please try this code and let me know if it works for you!
var mtom = new GlideRecord('sc_item_option_mtom');
mtom.addQuery('request_item',current.sys_id);// sys_id of sc_req_item record
mtom.query();
while(mtom.next()) {
gs.info("type of variables : " + mtom.sc_item_option.item_option_new.type.getDisplayValue());
}