Auto close ticket from RITM if another ticket on that RITM is closed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2023 02:54 AM
Table = SC_REQ_ITEM
We have Walk Up Appointments configured that are linked to Request Items (Walk Up Appointment has RITM number associated with it as reference)
When the Walk Up Appointment is closed, we would like to close the final task associated with the same RITM, see below screenshot from RITM related lists the final task "Laptop for " to be closed if the Walk Up Appointment record is closed , no longer active
Is this possible via like a client script in Walk Up appointment record table to lookup request item task that starts with xxx and close it if the Walk Up Appointment is updated as inactive?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2023 05:38 AM
Hi Priyanka,
I'm getting the following errors in the Client Script when trying to save

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2023 05:55 AM
Yes Right,
Sorry for the confusion
Please find below edited script
(function() {
if (current.u_status == 'inactive') {
var ritmSysId = current.u_ritm_sys_id;
var ga = new GlideAjax('CloseFinalTaskScript'); // Replace with your script include name
ga.addParam('sysparm_name', 'closeFinalTask'); // Replace with your server-side function name
ga.addParam('sysparm_ritm_sys_id', ritmSysId);
ga.getXML(function(response) {
var answer = response.responseXML.documentElement.getAttribute('answer');
if (answer == 'success') {
alert('Task closed'); // You can replace this with your desired notification method
} else {
// Handle the error case here
}
});
}
})();
Please mark it helpful, if it helped in finding solution
Thanks,
Priyanka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2023 05:59 AM
It still contains the current object