- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2021 12:26 PM
Hello,
I have a catalog item and a workflow. In my workflow, I have a catalog task with a script like this
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
Solved! Go to Solution.
- Labels:
-
Request Management
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2021 05:54 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2021 12:37 PM
Sure thing, just add this line to your Catalog Task Advanced script
current.assignment_group = task.assignment_group;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2021 01:06 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2021 01:31 PM
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);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2021 12:11 PM
Can you try the below code and let me know about the outcome?
task.assignment_group = request.requested_item.assignment_group ;