Cancel the change task on cancellation of change request
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2022 06:38 PM
Hi All,
I need help to cancel the change task on cancellation of change request. Currently, I am using the below script and it is cancelling the change task only when change task assigned to is NOT Empty. If assigned to on change task remains empty then it do not cancel it.
This BR is on After on changer request table and condition is "active changes to false".
var gr = new GlideRecord('change_task');
gr.addQuery('active', true);
gr.addQuery('change_request.sys_id', current.sys_id);
// I tried this line also gr.addQuery('change_request', current.sys_id); --- didn't help
gr.query();
while(gr.next())
{
gr.state=7; // cancel value
gr.active=false;
gr.update();
gs.addInfoMessage('test2');
}
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2022 09:01 PM
Hi,
As
URL - https://instance_name.service-now.com/sys_script.do?sys_id=16bd8e77c34332001488b731c1d3aeeb&sysparm_record_target=sys_script&sysparm_record_row=1&sysparm_record_rows=1&sysparm_record_list=nameSTARTSWITHCancel+change_tasks%5EORDERBYDESCsys_updated_on
Thanks,
Sagar Pagar