- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2020 10:13 AM
Hi All,
I want to set the assignment group in request form as per the task's assignment group which is generated within it.
kindly suggest on this.
in advance thanks.
Thanks,
Shrinivasprasad
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2020 08:35 AM
Hi,
the above script should work; did you try adding logs and check
Can you share the script you are using in catalog task activity script section
var record = new GlideRecord('sc_request');
record.addQuery('sys_id', current.request);
record.query();
if(record.next()){
gs.info('Inside Record');
record.assignment_group = task.assignment_group;
record.update();
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 07:36 AM
Hi,
in the workflow catalog activity for 1st task use this script
I assume task.assignment_group already contains the group sys_id
var record = new GlideRecord('sc_request');
record.addQuery('sys_id', current.request);
record.query();
if(record.next()){
record.assignment_group = task.assignment_group;
record.update();
}
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2020 10:20 AM
You can write a business rule on Catalog Task and update Assignment group on Request but not sure what's your scenario is, what if there are multiple catalog tasks assigned to Request ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2020 06:18 PM
Hello Shiva,
You can create a AFTER BR if this is for all catalog items. If not you can update using run script. This is assuming one task is created at a time.
- Pradeep Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 03:32 AM
HI Pradeep,
no it is only for particular item, if you have any code for run script for this case please provide me.
Actully there are two tasks are creating in RITM, based on that task's assignment group the assignment group of REQ should filled.
Thanks in advance.
Thanks,
Shrinivasprasad

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 06:39 AM
If you are creating task from workflow click on advanced on catalog Task activity and give the code as below.
try{
updateGroup();
}
catch(e){
gs.log('Error from run script'+ e);
}
function updateGroup(){
var request = new GlideRecord('sc_request');
request.addQuery('sys_id', current.request);
request.query();
if(request.next()){
request.assignment_group = task.assignment_group; //Assignment Group Sys id
req.update();
}
}