Variable type from ritm script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2023 08:06 AM
I need to populate variable values to ritm description. I need to skip populating variables of type html. Is there a way to identify the variable type for an existing ritm ? Something like current.variables.variable_name.type?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2023 08:23 AM
Hi @Varun30
You can run below script to get the variable type in your request item
var ReqItem = new GlideRecord('sc_item_option_mtom');
ReqItem.addQuery('request_item','5a21618e9757e910994b30d3f153af64'); // add RITM sys_id
ReqItem.query();
while(ReqItem.next())
{
gs.log(ReqItem.sc_item_option.item_option_new.type.getDisplayValue());
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2023 08:29 AM
Thanks for the reply. This will give me list of all variable types in ritm. I am looking for something like you pass the variable in ritm to script include and it returns the variable type. Basically this format :
variable_name : variable_type
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2023 08:34 AM
Then just modify like below
var ReqItem = new GlideRecord('sc_item_option_mtom');
ReqItem.addQuery('request_item','5a21618e9757e910994b30d3f153af64'); //pass ritm sys_id
ReqItem.query();
while(ReqItem.next())
{
if(ReqItem.sc_item_option.item_option_new.name=='photoshop'){ //pass variable backend name
return ReqItem.sc_item_option.item_option_new.type.getDisplayValue();
}}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2023 12:10 PM
Thats the thing. I don't want to limit it to one catalog item. In your example, I don't know the 'photoshop' variable type. I need to iterate through all variables in ritm and identify html variables.