How to set the assignment group in request form as per the task's assignment group.

shrinivasprasad
Tera Expert

Hi All,

I want to set the assignment group in request form as per the task's assignment group which is generated within it.

find_real_file.png

kindly suggest on this.

in advance thanks.

Thanks,

Shrinivasprasad

1 ACCEPTED SOLUTION

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

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

21 REPLIES 21

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Bharath40
Giga Guru

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 ?

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

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

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 

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();
}
}