I want list of incident records using background script that created 10 days ago from now ?

Abhishek Kathe
Mega Guru
 
1 ACCEPTED SOLUTION

Prasanna Kumar7
Tera Expert

Hi @Abhishek Kathe,

 

Please find the filter that we need to apply to get the incidents created 10 days ago from now.

 

PrasannaKumar7_0-1695040328451.png

 

Query = sys_created_onRELATIVEGT@dayofweek@ago@10

 

Please Click helpful if you got the answer.

 

Kind Regards,

Prasanna

 

View solution in original post

8 REPLIES 8

Vishal Birajdar
Giga Sage

Hi @Abhishek Kathe 

 

Try below bg script:

 

var gr = new GlideRecord('incident');

gr.addEncodedQuery('sys_created_onRELATIVEGT@dayofweek@ago@10');

gr.query();

while(gr.next()){

 gs.info(gr.number);

}

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates

Mark Roethof
Tera Patron
Tera Patron

Hi there,

 

Can you explain a bit what you are really after? Is it that you tried scripting something, and you are receiving an error? Is it that you are searching for a solution for a certain question, and might this not be a good solution actually? Or is it that you have no scripting knowledge and wanting to learn from this? 

Based on that, we actually can really help you instead of just pasting some script here which also might not be a good solution.

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Prasanna Kumar7
Tera Expert

Hi @Abhishek Kathe,

 

Please find the filter that we need to apply to get the incidents created 10 days ago from now.

 

PrasannaKumar7_0-1695040328451.png

 

Query = sys_created_onRELATIVEGT@dayofweek@ago@10

 

Please Click helpful if you got the answer.

 

Kind Regards,

Prasanna