The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Set Assignment group and Category for Inbound email action

harish11
Mega Expert

Am trying to set the fields for 'Assignment group = Microsoft team ' and 'Category 1 = Application and Category 2 = Microsoft, for an inbound Forwarded Email action.

Can someone please help with this. Am currently using an OOB script, as below. Thank you.

current.comments = "forwarded by: " + email.origemail + "\n\n" + email.body_text;

current.short_description = email.subject;

// create the caller only if I have itil role

//if (gs.hasRole("itil"))

  // current.caller_id = gs.createUser(email.body.from);

current.opened_by = email.from_sys_id;

current.assignment_group.setDisplayValue("Microsoft");

//and

current.assignment_group = ("Microsoft");

current.u_cat_1 = ("Application");

current.u_cat_2 = ("Microsoft");

current.incident_state = 1;

current.notify = 2;

current.contact_type = "email";

if (email.body.assign != undefined)

    current.assigned_to = email.body.assign;

if (email.body.priority != undefined)

    current.priority = email.body.priority;

current.insert();

1 ACCEPTED SOLUTION

Deepak Ingale1
Mega Sage

current.assignment_group.setDisplayValue("Microsoft"); // This is correct


// current.assignment_group = ("Microsoft"); // This is wrong correct way is shown below


current.assignment_group = 'sys_id' of the group ; // this is right


current.u_cat_1 = ("Application"); // this is wrong there should not be a bracket after assignment operation, rather it should be a value of choice


current.u_cat_2 = ("Microsoft"); // this is also wrong


current.u_cat_2.setDisplayValue('Microsoft'); // this is right similarly do for 1st category


View solution in original post

4 REPLIES 4

Mike Allen
Mega Sage

You can do current.assignment_group.name = 'Microsoft';



But, I'd probably just find the sys_id and use it.



What exactly is happening?   Nothing?


palmen
Tera Guru

You could also use a template to set some values



//Apply template


current.applyTemplate("name of template");




Otherwise it's probably easier to do this with the sys_id of the group. By using the sys_id the inbound action will still work even if you change the name of the group.



current.assignment_group = '7285123a54e45580342fab8ffa2f5a7d'; //Microsoft team


Deepak Ingale1
Mega Sage

current.assignment_group.setDisplayValue("Microsoft"); // This is correct


// current.assignment_group = ("Microsoft"); // This is wrong correct way is shown below


current.assignment_group = 'sys_id' of the group ; // this is right


current.u_cat_1 = ("Application"); // this is wrong there should not be a bracket after assignment operation, rather it should be a value of choice


current.u_cat_2 = ("Microsoft"); // this is also wrong


current.u_cat_2.setDisplayValue('Microsoft'); // this is right similarly do for 1st category


Thanks guys.. Much appreciated.