Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

How to find RITM record on the basis of variable value using script?

ak49
Tera Contributor

I need to find the RITM record whose Item name is "XYZ" and variable "software = adobe" how can we do that in background script

1 ACCEPTED SOLUTION

SumanthDosapati
Mega Sage

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

View solution in original post

3 REPLIES 3

Maik Skoddow
Tera Patron

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

SumanthDosapati
Mega Sage

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

Hi Thanks It's working