you can try something like



current.assigned_to.setDisplayValue(email.body.assignedto);



That should set the value based on the name.   The problem there is that the first John Smith in the list will be the assigned_to value.



-Chris


Thanks, Chris



This was also helpful. Allowed me to use the names instead of sys_ids.


ewanh
Kilo Expert

I have a similar issue to Nick's.



Here is my script:



if (email.importance != undefined) {


    if (email.importance.toLowerCase() == "high")


          current.priority = 1;


}



if (email.body.priority != undefined)


    current.priority = email.body.priority;



if (email.body.category != undefined)


  current.category = email.body.category;



if (email.body.sub != undefined)


  current.subcategory = email.body.sub;



if (email.body.desc != undefined)


  current.work_notes = email.body.desc;



if (email.body.impact != undefined)


  current.impact = email.body.impact;



if (email.body.urgency != undefined)


  current.urgency = email.body.urgency;



if (email.body.group != undefined)


  current.assignment_group = email.body.group;



if (email.body.assignee != undefined)


  current.assigned_to = email.body.assignee;



current.insert();



event.state="stop_processing";


Email is:



Subject: [whatever you want it to be]


Content:


Requestor: Joe User
Category: Infrastructure
Sub: Network
Impact: 1
Urgency: 1
Group: Infrastructure
Assignee: Joleen Technician
Desc: Critical: node down triggered for Seattle 20th floor Switch 4


I can get the script to interpret/populate everything but the Assignment Group.   Not sure why I can't get that to work...I've looked at assignment rules, dictionary, field settings, business rules.   Anybody have an idea?


coryseering
ServiceNow Employee

Hi Ewan,


Did you use Chris' suggestion to use current.assignment_group.setDisplayValue() rather than direct assignment? Given that the inbound value for assignment group int hat email is "Infrastructure" rather than they sys_id of the Infrastructure group, you can't use direct assignment (reference fields have a value- a sys_id, and a display value- like a name). Since you're getting the name in your email, you need to either try setting that (and let the system look up an appropriate sys_id for a group with that name), or explicitly do the query yourself, find the right group, and assign it's sys_id to current.assignment_group.


That was it!   Thanks Cory.