Auto Close Problem after 7 days

Mark Wood
Tera Contributor

Hello Experts,

I am seeking guidance on a requirement to close problem tickets that have not had any incidents for 7 days. I attempted to fulfill this requirement using a scheduled job, but unfortunately, my script is not functioning as expected. Could someone please assist me with this? Thank you.

 

var prb=new GlideRecord('problem');
prb.addEncodedQuery('stateNOT IN106,107^related_incidents=0');
prb.setLimit(1);
prb.query();
while(prb.next())
{
prb.state=107;
prb.fix_notes=" test Scheduled Job";
prb.update();

}

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Mark Wood 

script looks fine

did you try checking any mandatory field is blocking the update via data policy?

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

View solution in original post

4 REPLIES 4

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Mark Wood 

 

Did you try with Flow designer, a low code way to do this. 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Ankur Bawiskar
Tera Patron
Tera Patron

@Mark Wood 

script looks fine

did you try checking any mandatory field is blocking the update via data policy?

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

Hello @Ankur Bawiskar,

The issue has been resolved; it was due to an exception in the data policy. Thank you @Ankur Bawiskar and @Dr Atul G- LNG for your assistance.

@Mark Wood 

Glad to know.

Did you mistakenly marked your own response as correct?

My response pointed out the data policy point.

Would you mind marking my response as correct so that it benefits future readers.

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