Is there a way to automatically reassign tasks when the request is assigned to a different resource group?

zabrina
Mega Expert

If not, is there some sort of workaround like creating mandatory fields or notifications reminding the transferring group to change the resource group on tasks? Any suggestions would be helpful.

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

I'm going to make the following assumptions. Please correct me if I'm wrong.


  • You are reassigning a request item by changing the assignment group
  • You want to reassign any active/open tasks (and leave completed ones alone.)


It would be done with an AFTER business rule something like this:



Name: Reassign active tasks


Table: Requested Item (sc_req_item)


When: After


Insert: true


Update: true


Advanced: true


Condition: Assignment group | changes


Script:


(function executeRule(current, previous /*null when async*/) {


        var task = new GlideRecord('sc_task');


        task.addQuery('request_item', current.getValue('sys_id'));


        task.addQuery('active', true);


        task.query();



        while (task.next()) {


                  task.assignment_group = current.assignment_group;


                  task.update();


        }


})(current, previous);


View solution in original post

19 REPLIES 19

bernyalvarado
Mega Sage

Hi Zabrina,



Sure. You can create an onAfter Business Rule that runs on insert / update of the request table. On the script of that business rule you will do a search on the sc_req_items (requested items) table and retrieve all the record where the parrent is the current request. Within the iteration of that glide record you will then update the assignment group according to the assignment group of the request.



Thanks,


Berny


bernyalvarado
Mega Sage

I hope this helps .



Thanks,


Berny


Chuck Tomasi
Tera Patron

I'm going to make the following assumptions. Please correct me if I'm wrong.


  • You are reassigning a request item by changing the assignment group
  • You want to reassign any active/open tasks (and leave completed ones alone.)


It would be done with an AFTER business rule something like this:



Name: Reassign active tasks


Table: Requested Item (sc_req_item)


When: After


Insert: true


Update: true


Advanced: true


Condition: Assignment group | changes


Script:


(function executeRule(current, previous /*null when async*/) {


        var task = new GlideRecord('sc_task');


        task.addQuery('request_item', current.getValue('sys_id'));


        task.addQuery('active', true);


        task.query();



        while (task.next()) {


                  task.assignment_group = current.assignment_group;


                  task.update();


        }


})(current, previous);


Hi I tried this but it didn't work. Something is wrong with the syntax. Thanks.