to set assignment group on task

ramya73
Tera Contributor

I have Record producer “report connection issue” on incident table, in that I have a reference filed called “mill” reference to core_company , Core_company has child tables

 if the selected mill is form “cmdb_ci_mill” table and  conection type (choice):other  I need to send task  to “other group”

if the selected mill is form “cmdb_ci_mill” table conection type (choice):company  I need to send task  to “company group”.

Also we have “Auto task creation “ Business rule, I am facing problem how to find incident is creating form record producer ,how to assign the assignment group based on mill selection

 

Please help me, thanks in advance.

I wrote  record producer script:

var answer = "";

var groupGR = new GlideRecord("sys_user_group");

var mill = new GlideRecord("cmdb_ci_mill");

mill.addQuery('u_mill_name',producer.mill);     

mill.addQuery('u_connection_type','Other ');

mill.query();

if (mill.next()) {

    groupGR.get("name", " other group”);

    answer = groupGR.getValue("sys_id");

} else {

    groupGR.get("name", " company group ");

    answer = groupGR.getValue("sys_id");

}

 

3 REPLIES 3

Allen Andreas
Administrator
Administrator

Hello,

In your record producer script, if you have a reference field on the record producer, you can dot-walk through that and set the assignment group as needed (this is just an example, please use this and go from here😞

if (producer.field_name.u_connection_type == 'Other') {
current.assignment_group = 'sys_id_of_group';
} else {
current.assignment_group = 'sys_id_of_other_group';
}

So here you'd need to ensure Other is the value for that u_connection_type and not other (lowercase).

Then use the sys_ids of the group or set a system property to that sys_id and then instead of using the sys_id in this script, you'd use the property such as: gs.getProperty('name_of_property');

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

ramya73
Tera Contributor

thanks for reply

based on mill and contact type I need to set incident Task assignment group ,

already I Have business rule to auto create "TASK" 

 

Business Rule:

when to run: after   insert

advanced:

var GR = new GlideRecord('incident_task');
GR.initialize();
GR.impact = current.getValue('impact');
GR.urgency = current.getValue('urgency');
GR.priority = current.getValue('priority');

if (JSUtil.notNil(current.cmdb_ci.u_application.u_application_service.support_group)) {
GR.assignment_group = current.cmdb_ci.u_application.u_application_service.support_group + '';
} else {

// I need to set assignment group based on mil and contact type selection in record producer
GR.assignment_group = '345cec0a8016700a222a0f7900d06';
}


GR.parent = current.getValue('sys_id');
GR.insert();

please help me

ramya73
Tera Contributor

I want to know the particular incident is created from the record producer

after that I need to set assignment group based on mil and contact type selection in record producer