- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2024 04:48 AM
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();
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2024 05:19 AM
script looks fine
did you try checking any mandatory field is blocking the update via data policy?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2024 05:06 AM
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]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2024 05:19 AM
script looks fine
did you try checking any mandatory field is blocking the update via data policy?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2024 05:41 AM
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 as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2024 06:01 AM
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.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader