- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2023 12:02 AM
Hello Experts,
I would like to detect sc_cat_item variable type used in existing ritm tickets, but wondering how to do it. Usage of .getInternalType returns as example "com.glide.vars2.Variable" but not type like Single Line Text.
Is there any way to return variable Type info?
while (grReqItem.next()) {
var variables = grReqItem.variables;
for (var variableName in variables) {
var elementDescriptor = grReqItem.variables[variableName].getED();
gs.info('Setting variable: ' + elementDescriptor + ' type:' + elementDescriptor.getInternalType() + ' value: ' + grReqItem.variables[variableName]);
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2023 12:46 AM
Hi @AnttiTapiola,
I would suggest to get the Catalog item using RITM requests.
Once you get the Catalog item, you need to Glide Variables [item_option_new] table and query with catalog item and you will get the variable typos.
If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers.
Thanks,
Sagar Pagar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2023 12:41 AM
Hey,
for variables there is a many-to-many table which links the variable to their request item:
sc_item_option_mtom
There you can filter for your request item. This will give you all references to the sc_item_option table which stores the instance of a variable with it's value. This then references the catalog variable itself. And there you then find the type of variable.
In case of any further input needed, feel free to respond.
Regards
Fabian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2023 12:46 AM
Hi @AnttiTapiola,
I would suggest to get the Catalog item using RITM requests.
Once you get the Catalog item, you need to Glide Variables [item_option_new] table and query with catalog item and you will get the variable typos.
If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers.
Thanks,
Sagar Pagar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2023 02:33 AM
Hello,
This is an easy and great solution! However, please keep in mind, that if a catalog item changes over time to a new version with different variables, the variables of a request item may no longer match with the variables of the catalog item. Variables could be missing or be replaced/updated.
Regards
Fabian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2025 07:04 AM - edited 06-05-2025 07:05 AM
I needed to check if variable is checkbox and if it is, then return its label.
Use current.variables.var_name.getQuestion().getType() to get the variable type
var checkboxType = '7';
var varName = <<var_name>>;
var label = '';
var current = new GlideRecord("sc_req_item");
if (current.get(<<sys_id>>)){
var myVar = current.variables[varName];
var isBoolean = myVar.getQuestion().getType() == checkboxType;
if (isBoolean){
label = myVar.getLabel();
}
}