How to change sc_task assignment group based on RITM assignment group dynamically?

jennyjenny
Kilo Contributor

Hi All,

I have created one catalogue item and attached workflow to it.

When submitting the request the RITM will create along with TASK .

When I change CI and Short description from RITM from it is getting reflected on to the task except assignment group .

I have writtent the code as showm below .

find_real_file.png

The assignment group is not changing when I change in RITM form, The TASK assignement group should be same as RITM assignment group as per my requiremnt .

When creating task along with RITM the assignment group is getting reflected on to the task form but When I change change the assignment group from RITM form it is not getting reflected on to the TASK form.

But all other Configuation Itema and Short description are getting changed when I change on RITM form.

Can anybody help on this.

Thank you .

Jenny

1 ACCEPTED SOLUTION

Hi Jennifer,



If you want to change the assignment group of catalog task then you have to glide it and update it.



Something like below................




  current.configuration_item = current.variables.printer_plotter;


  current.assignment_group = current.configuration_item.support_group;


  var sTask = new GlideRecord('sc_task');


  sTask.addQuery('request_item',current.sys_id);


  sTask.query();


  while(sTask.next()){


  sTask.assignment_group = current.configuration_item.support_group;


  }


  sTask.update();



Thanks,


Kartik


View solution in original post

10 REPLIES 10

Hi Jennifer,



Are you changing the group value on the RITM form after the workflow trigger?



Thanks,


Kartik


Yes Karthik, as added in above reply, I am changing the configuration item(printer/plotter) varible from catalogue item form, when i chage the varible it will set in to RITM configuration item.


The assignment group will set based on configuration item support group .



Thanks,


Hi Jennifer,



Please put log statement in BR. Check if you are getting the values.



Thanks,


Kartik


Hi Karthik,



I have written BR on sc_req_item table, it working successfully on item,i.e changing assignment group based on configuartion item successfully.


I add highlighted line the gs.addInfoMessage is not working


find_real_file.png




Thanks,


Hi Jennifer,



If you want to change the assignment group of catalog task then you have to glide it and update it.



Something like below................




  current.configuration_item = current.variables.printer_plotter;


  current.assignment_group = current.configuration_item.support_group;


  var sTask = new GlideRecord('sc_task');


  sTask.addQuery('request_item',current.sys_id);


  sTask.query();


  while(sTask.next()){


  sTask.assignment_group = current.configuration_item.support_group;


  }


  sTask.update();



Thanks,


Kartik