- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2024 04:56 AM
Hi All,
I have a catalog item which creates a task. Once the task is closed the RITM is assigned to the requestor for him to close it. I want however to close it if user does not do it himself after 3 days.
How to approach it?
thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2024 06:41 AM
Hello,
Considering its a custom requirement. You can achieve this via "Schedule Job" or "Flow Designer":-->
Example Script :-
using schedule Job :-
var ritmGr = new GlideRecord('sc_req_item');
ritmGr.addQuery('state', 'Closure'); // Assuming "Closure" is the state where it's waiting for the requestor to close it
ritmGr.addQuery('sys_updated_on', '<=', gs.daysAgo(3));
ritmGr.query();
while (ritmGr.next()) {
ritmGr.state = 'Closed';
ritmGr.work_notes = "RITM automatically closed after 3 days of no action from the requestor.";
ritmGr.update();
}
using Flow :-
-
Create a Flow:
- Navigate to Flow Designer and create a new flow.
- Set the trigger to When Task is Closed.
-
Wait Condition:
- Add a Wait for Condition action that waits for 3 days.
- Use the "Wait for" action and set it to wait for 72 hours (3 days).
-
Check RITM Status:
- Add a Condition after the wait to check if the RITM's state is still in a state indicating it's awaiting user closure (e.g., "Pending Closure").
-
Close the RITM:
- If the RITM is still not closed, add an Update Record action to change the state of the RITM to "Closed" or any other appropriate state.
- If the RITM is still not closed, add an Update Record action to change the state of the RITM to "Closed" or any other appropriate state.
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
YouTube: https://www.youtube.com/@learnservicenowwithravi
LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2024 04:59 AM
Hi @dev_K
Follow Best practice:
Once an catalog task get closed, RITM - REQ get closed automatically. Follow this, please.
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
08-22-2024 05:02 AM
@dev_K You can achieve this by either implementing a scheduled job or a workflow. In case of the scheduled job, you job will run every day and compare the created date of the task with today's day and choose to close the task if the user didn't close it in 3 days. In case of workflow, you can choose to have a timer which will wait for 3 days and close the task using a run script if the task didn't complete in three days.
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2024 05:49 AM
Hi @dev_K
You can implement this condition in related flow. You can use Wait for condition action that will Pause a flow until record values match a specific set of conditions.
Refer: Wait For Condition action
https://docs.servicenow.com/bundle/vancouver-build-workflows/page/administer/flow-designer/concept/f...
If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful."
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2024 06:14 AM
Hi @dev_K
You should consider the opinion of Atul, but if you having the custom requirement likewise then you can create 'scheduled job' which runs daily.
In condition you should mention the 'state' of RITM (I hope you having specific RITM 'state' after task closure
e.g., "Pending User Closure")
You can refer my below script:
// Get the GlideDateTime for 3 days ago
var threeDaysAgo = new GlideDateTime();
threeDaysAgo.addDaysUTC(-3);
//RITMs 3 or more days ago updated to state and are still open
var ritmGr = new GlideRecord('sc_req_item');
ritmGr.addQuery('state', 'YOUR_STATE_HERE'); // Replace state you use for "Pending User Closure"
ritmGr.addQuery('sys_updated_on', '<=', threeDaysAgo);
ritmGr.query();
while (ritmGr.next()) {
// Close the RITM
ritmGr.state = 3; // state to Closed Complete
ritmGr.work_notes = 'RITM auto-closed after 3 days of inactivity by the requestor.';
ritmGr.update();
}
I hope my answer helps you to resolve your issue if yes please mark my answer helpful and correct.
thank you
rajesh