Auto-close RITMs not approved within 30 days

Tracey Wilmot
Tera Contributor

Currently, we are running a report on a daily basis to check for unapproved requests and manually marking them as Closed Incomplete if the request is not approved within 30 days.  We are looking for a way to automate this.

I think I need to setup a Scheduled Job but I'm not sure what the content of the script should be.  Any help would be greatly appreciated.

Many thanks
Tracey

1 ACCEPTED SOLUTION

Yes, you can trigger an email here. Refer to screenshot below from the above code which I have shared:

find_real_file.png

So just after gs.log line you can use below syntax to trigger your notification:

gs.eventQueue('Event Name',children,recipeint1, recipient2);

//Replace recipeint1 & recipeint2 should be the user object to whom you want to send the email to. 
Also Event Name need to be configured by navigating to "Registry" module and then use it here.

 

Then go to Notification module and use Trigger as Event is fired and select the same event name and make sure to check below parameter as True in Whom to receive tab:

Parm1

Parm2

Send to Event Creator

 

Then finally define the Notification content.

Regards,

Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

View solution in original post

18 REPLIES 18

Thanks Mike!

So in each approval, I need to add a Duration (see below screenshot).  By adding a Duration, will this auto close the request if an approval is not received in a timely manner or will I need to take additional steps?

find_real_file.png

Community Alums
Not applicable

Hi Tracey, 

No, sorry, not quite that simple! This is a feature of Flow Designer. 

If you've no intention of moving your requests from Work Flow to Flow Designer, I'd suggest doing it in flow anyway. You can do a flow like this: 

find_real_file.png

The "update record" action here sets the state to rejected, and adds a comment to say it's rejected due to being more than 30 days old. 

Sourav16
Kilo Guru

Hi,

You can use Flow Designer for this without writing any code :-

Flow Designer - ServiceNow Docs

Anil Lande
Kilo Patron

Hi,

It depends how you want to proceed.

You can use timer(30 days) in workflow and check if request is approved or not. if request is still pending for approval then close incomplete the request.

Also you can use scheduled job and use script to check OPEN RITM's which are created 30 days before and approval is pending. Update state to closed incomplete through script.

You can use Flow for the same.

 

Thanks,
Anil Lande 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Thanks Anil.  Further to my response to Mike above, we have many different workflows that we need to apply this to, which is why I thought a scheduled job will be required.

Only problem is I don't have any scripting experience.  I've checked on the community and found some scripts but when I've executed they seem to mark the approvals as 'closed incomplete' but the request item stays 'Open'.

Any help greatly appreciated.

Tracey