Set Assignment group at RITM level from catalog task script in workflow

Apex Predator
Kilo Expert

Hello,

I have a catalog item and a workflow. In my workflow, I have a catalog task with a script like thisfind_real_file.png

 

Can I set the Assignment Group at the RITM level from here. My task get an assignment group set using assignment rules. I want the same group to appear here. How can do it using this script?
Thank you

1 ACCEPTED SOLUTION

I don't want to assign the group to the task. I want it the other way around. I was able to achieve this in the workflow by modifying the above mentioned script and putting it inside the 'Run Script' in workflow. I query the task table with the sys_id of RITM, get the task object, get it's assignment group and assign it to RITM's assignment group.

View solution in original post

5 REPLIES 5

Brad Bowman
Kilo Patron
Kilo Patron

Sure thing, just add this line to your Catalog Task Advanced script

current.assignment_group = task.assignment_group;

This is not assigning it. find_real_file.png

 

find_real_file.png

 

find_real_file.png

 

Is this script supposed to run as soon as a task is created? 

We are using this on several workflows, but the task assignment group is being set either via the Fulfillment group field on the task definition, or in the Advanced script with some logic.  Using assignment rules must populate the assignment group after the task is created.

The next thing to try is a before Insert and Update Business Rule running on the sc_task table.  You can add the Filter Conditions to only run on this catalog item and/or this specific task if you want, then also add 'Assignment group changes'.  Then you can either add on the Actions tab to Set field values (first show Related Fields) 'Request item.Assignment group Same as Assignment group' or if that doesn't work (it may not save the RITM record since the rule is running on the sc_task table?) add this Script on the Advanced tab

(function executeRule(current, previous /*null when async*/) {
  var ritm = new GlideRecord('sc_req_item');
  ritm.addQuery('sys_id',current.request_item);
  ritm.query();
  if(ritm.next()){
    ritm.assignment_group = current.assignment_group;
    ritm.update();
  }
})(current, previous);

Can you try the below code and let me know about the outcome?

 

task.assignment_group = request.requested_item.assignment_group ;