Background script to close Requests when RITM is Closed complete

AdrianHolm
Tera Guru

Hello Community,

As the title says; I could need some help writing a background script to close all our Requests when RITM have State Closed complete. We have approximately 130 Requests where RITM is Closed complete, so I believe there is a issue with a BR in our instance. I'm currently on the path of learning to write my own scripts, but unfortunately this is out of my skills. 

Thanks in advance!

 

Best regards,
Adrian H

14 REPLIES 14

Mark Roethof
Tera Patron
Tera Patron

Hi there,

You mean a script to one time fix these corrupted requests?

I mean, out-of-the-box, they should be closed automatically. Did you reproduce/investigate why these records did not close? Did you fix that possible issue? 

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

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

LinkedIn

Hi @Mark Roethof,

Yes, I mean a script to one time fix these corrupted requests.

When it comes to reproducing/investigating the reason why these records did not close, I've just started. So far, I believe it either has to do with a BR or workflow. I recently took over as a system administrator, so I'm not familiar on how it's been done earlier.

Thank you for your reply!

 

Best regards,
Adrian H 

Hi there,

You could go for scripting like some community members already posted. I'm not sure if that's the best approach. I would dig into the impact a bit further. For example, are there still workflows also active for the requests? Or are these all closed? If still active, one of the suggested scripted options should be avoided! (the suggestion with setWorkflow(false)).

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

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

LinkedIn

I think this out-of-the-box business rule is handling the Request closure if all Requested Items are closed:

find_real_file.png

Check if this one is still working, has been changed, etc..

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

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

LinkedIn