- 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 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-23-2024 03:36 AM
Hi!
I opted for the flow solution.
It seems to work but only when I perform test in a flow, when I dont the RITM is not updated. Why this happens?
Here is the flow:
Applies only to specific catalog items, when the status changes to work in progress:
For testing I set 5 sec:
then after 5 sec it will check if the status is still closed complete and if true, it will change it to closed complete:
Testing a sc_task record:
then the record is updated correctly:
but when I dont do those test for the sc_task record the RITM status does not change... why?