Canceling a ServiceNow Request
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2022 12:42 PM
Hi all,
If I want to cancel a ServiceNow request, as a requester I want to choose the Request state as "Closed Cancelled". When this is selected, I want the state on the RITM and the SCTask to change to Closed Skipped.
Can you let me know how this can be achieved?
Thanks,
Mallika
- Labels:
-
Multiple Versions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2022 12:46 PM
Hi,
Usually the requester is an external user or a user who shouldn't typically have the roles needed to update RITMs.
What is your requirement? Why do you want to do this. There may be a better solution
Here is a business rule to close RITM/SCTasks when the REQ request state is changed to closed cancelled.
Business rule:
Script:
(function executeRule(current, previous /*null when async*/) {
var ritm = new GlideRecord('sc_req_item'); //find the RITM and close it
ritm.addQuery('request', current.sys_id);
ritm.query();
if(ritm.next()) {
ritm.state = 7;
ritm.update();
}
var scTaskGR = new GlideRecord('sc_task'); //find all the SC Tasks and close them
scTaskGR.addQuery('request_item.request', current.sys_id);
scTaskGR.query();
while (scTaskGR.next()) {
scTaskGR.state = 7;
scTaskGR.update();
}
})(current, previous);
Please mark my answer as Correct/Helpful based on impact
Regards,
Dan H
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2022 01:30 PM
Hi
Sometimes the user submits a request and after the task is created realize that the request is no longer required.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2022 01:35 PM
Okay, no problem.
The business rule I have posted will fulfill your request.
Let me know if there is any issues, i'm happy to help.
Please mark my answer as Correct/Helpful based on impact
Regards,
Dan H
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2022 09:41 AM
Hi
I tried using the business rule you shared but it is changing the State on the RITM and the Task to Closed Incomplete.
Is this an OOB feature of ServiceNow?
Thanks,
Mallika