Auto close ticket from RITM if another ticket on that RITM is closed

Ahmet1
Tera Expert

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

Ahmet1_1-1692870780743.png

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?

 

7 REPLIES 7

Hi Priyanka, 


I'm getting the following errors in the Client Script when trying to save

Ahmet1_0-1692880698363.png

 

Community Alums
Not applicable

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

It still contains the current object

Ahmet1_0-1692881956788.png