- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2022 05:22 AM
I need to find the RITM record whose Item name is "XYZ" and variable "software = adobe" how can we do that in background script
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2022 05:56 AM
Hi,
Try this script in background script
var gr = new GlideRecord("sc_req_item");
gr.addEncodedQuery('cat_item=9eca17cc2ff05d9078f324c62799b6d2'); //sysid of your catalog item
gr.query();
while(gr.next())
{
if(gr.variables.variable_name == "variable_value") //in your case (gr.variables.software == 'adobe')
{
gs.info(gr.number + "\n");
}
}
Mark as correct and helpful if it solved your query.
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2022 05:30 AM
Hi
try this (assuming variable "software" is of String type, if not use Sys ID as value):
var grRITM = new GlideRecord("sc_req_item");
grRITM.addQuery('item.name', 'XYZ');
grRITM.addQuery('variables.software', 'adobe');
grRITM.query();
Maik

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2022 05:56 AM
Hi,
Try this script in background script
var gr = new GlideRecord("sc_req_item");
gr.addEncodedQuery('cat_item=9eca17cc2ff05d9078f324c62799b6d2'); //sysid of your catalog item
gr.query();
while(gr.next())
{
if(gr.variables.variable_name == "variable_value") //in your case (gr.variables.software == 'adobe')
{
gs.info(gr.number + "\n");
}
}
Mark as correct and helpful if it solved your query.
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2022 06:58 AM
Hi Thanks It's working