I am having difficulties setting my location field for Incidents using inbound email actions.

Mark_Bailey
Mega Guru

I am having difficulties setting my location field for Incidents using inbound email actions.

I use inbound email to create and set fields often, but have never used the location table as a field to set. I do notice that all the other fields I am setting are on the incident table, and the location ID is on the task table.   I assume I need something else in the script to reference to another table?

Any help is appreciated.   Everything sets fine except location.

pic1.jpg

pic2.jpg

pic3.jpg

  1. current.comments = "received from: " + email.origemail + "\n\n" + email.body_text;
  2. current.short_description = email.subject;
  3. current.contact_type.setDisplayValue ("email");
  4. current.assignment_group.setDisplayValue ("Supply Chain Systems");
  5. current.category.setDisplayValue ("Application");
  6. current.opened_by.setDisplayValue ("StoreOps");

if (email.body.store != undefined)

                            current.location = email.body.store;

if (email.body.sn != undefined)

                            current.caller_id = email.body.sn;

  1. current.insert();
  2. event.state="stop_processing";
1 ACCEPTED SOLUTION

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Hi Mark,



For your location line I would try:



current.location.setDisplayValue(email.body.store);



The location is expecting a sys_id, so you have to tell it you're giving it the display value.


View solution in original post

2 REPLIES 2

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Hi Mark,



For your location line I would try:



current.location.setDisplayValue(email.body.store);



The location is expecting a sys_id, so you have to tell it you're giving it the display value.


I feel a little stupid. It works and thank you very much!


I thought about it, then thought why would I do this when   the caller_id part works which is also a reference field.



For my learning would you explain why the below works on the caller_id, and not on location, and if I should also make this change on the caller_id part?





if (email.body.sn != undefined)


                            current.caller_id = email.body.sn;