Write a script to display inactive problems with p2 incidents.

sabbani rishika
Tera Contributor

Script

12 REPLIES 12

Hi,

why to use GlideRecord in client script?

GlideRecord in client side is not recommended.

I believe this is not an actual business requirement from your customer

If you still require here is the updated script

var arr = [];
var gr = new GlideRecord('problem');
gr.addQuery("active", false);
gr.addQuery('state',4);
gr.query();
while(gr.next()){
	var r = new GlideRecord('incident');
	r.addQuery("problem_id", gr.sys_id);
	r.addQuery('priority',2);
	r.query();
	while(r.next()){
		arr.push(gr.number.toString());
	}
}

alert(arr);

regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@sabbani rishika 

Hope you are doing good.

Did my reply answer your question?

If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hii @Ankur Bawiskar ..The script which you have given also not working.

Hi,

share your script and where have you written it

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

find_real_file.png