How get incidents list if they created in last week in email notifications

bhanu kota
Kilo Explorer

I need a script for get last week created incidents list in email notifications

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

should be simple enough if you know how to use filter conditions and GlideRecord

1) visit incident table

2) apply the filter -> Created on Last Week

3) Copy the query

4) Use that in encodedQuery

var gr = new GlideRecord("incident");
gr.addEncodedQuery("sys_created_onONLast week@javascript:gs.beginningOfLastWeek()@javascript:gs.endOfLastWeek()");
gr.query();
while(gr.next()){

}

Regards
Ankur

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

@bhanu kota 

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

Hello Ankur,

Can you please tell me how can i get the incidents created in past 3 days for the same?

Musab Rasheed
Tera Sage
Tera Sage

Hello,

No script is required, follow below steps

1) Create simple Report which will give list of incidents created last week

2) Create scheduled report entry and refer report created in step 1 here, and configure rest

This way it is easier to get and this automation will run by default without any adjustment

Mark my answer as correct if that helps

Regards

Please hit like and mark my response as correct if that helps
Regards,
Musab