how to Cancel all SC Tasks in RITM when state changes to Close Incomplete using Business Rule

dhanashree2011
Tera Contributor

Hi all,

 

How to Cancel all SC Tasks in RITM when RITM state changes to Close Incomplete using Business Rule. 

The requirement is to close all SC Task under Closed Incomplete RITM's.

1 ACCEPTED SOLUTION

That is the OOB behaviour, to avoid this you can simply take one group's sys_id of servicedesk or some generic group and  write "tasks.assignment_group = <sys_id of assignment group>;

Please mark helpful/correct if my response helped you.

View solution in original post

8 REPLIES 8

Anubhav24
Mega Sage
Mega Sage

Hi @dhanashree2011 ,

 

You can write a BR on sc_req_item table with the filter when state changes to closed incomplete.

Under script you can query the sc_task table using the RITM number on "request_item" column on sc_task table and then you will get all the associated sc tasks with the RITM and then you can update all related sc tasks.

 

Please mark helpful/correct if my response helped you.

 

Thanks Anubhav.

I tried this as below but seem it is not working

 

var tasks = new GlideRecord('sc_task');
tasks.addQuery('requested_item', current.sys_id);
//tasks.orderBy('order');
tasks.query();
while (tasks.next()) {
tasks.state = 4;
tasks.update();
}

I tried below

 

var tasks = new GlideRecord('sc_task');
tasks.addQuery('sys_id', current.sys_id);
//tasks.orderBy('order');
tasks.query();
while (tasks.next()) {
tasks.state = 4;
tasks.update();
}

Please post screenshot of your BR @dhanashree2011