The CreatorCon Call for Content is officially open! Get started here.

How to get latest 10 records which are created from incident table

srinivas snow21
Kilo Explorer

How to get latest 10 records which are created from incident table

1 ACCEPTED SOLUTION

Murthy Ch
Giga Sage

@srinivas snow2270 

var grI=new GlideRecord("incident");
grI.orderByDesc("sys_created_on");
grI.setLimit(10);
grI.query();
while(grI.next())
{
    gs.info(grI.getDisplayValue());
}
Thanks,
Murthy

View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

something like this in background script

var gr = new GlideRecord("incident");
gr.orderByDesc("sys_created_on");
gr.setLimit(10);
gr.query();
while (gr.next()) {
	gs.info(gr.number);
}

Regards
Ankur

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

@srinivas snow2270 

Did you mistakenly marked other response as correct?

I could see you marked my response as correct earlier and not it is not.

The "Marked as Correct" answer is same as what I mentioned in my 1st response to your question.

Please mark appropriate response as correct based on timely response.

Regards
Ankur

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

Murthy Ch
Giga Sage

@srinivas snow2270 

var grI=new GlideRecord("incident");
grI.orderByDesc("sys_created_on");
grI.setLimit(10);
grI.query();
while(grI.next())
{
    gs.info(grI.getDisplayValue());
}
Thanks,
Murthy