pulling info from email to populate the short description

scottjus82
Kilo Guru

Hi

 

Using an inbound action I am trying to populate the short description with a line from the inbound email but my attempts have failed (again) I have tried using a script provided previously to be used in a record producer however thats failed. The email body will have the following lines, I want to pull the answers and add them to the short description stating New starter request for.....

 

 

First Name

Last Name

 

Any help would be greatly appreciated.

 

Regards

1 ACCEPTED SOLUTION

Have you tired using email.body.first_name (in lower case not upper case)



I think they may change the variables to all lower case when setting up the inbound integration.



Cheers,


Cameron


View solution in original post

19 REPLIES 19

so if I remove the space between First and Name the sytnax is fine however the line on the email is First space Name. This still does not populate the short description.



On another note, this inbound action was intially built on the incident table, I change it the Request (Sc_Request) and when processing emails it does not check through the email actions. the email log shows the recieved email line (Received new email with UID: 0000012c5182a7a7) but nothing after that, is there a reason inbound actions will not map to the request table?



Thanks


Hi,



Thaks again for input all,



its still not populating the description with first name. Below is my current if statement and below that I have included the body of the email that its pulling from, I am sure its sopmething quite simple now (a space or something its not expecting)



current.u_type = 'Request';


current.caller_id = GetIDValue('sys_user', 'New-Starter-Process');


current.u_category_level_1 = GetIDValue('cmdb_ci', 'Domain');


current.u_category_level_2 = GetIDValue('cmdb_ci', 'Access');


current.u_category = GetIDValue('u_category_lookup', 'Service Request');


current.priority = '9';


current.contact_type = 'email';


current.assignment_group = GetIDValue('sys_user_group', 'System Admin');


current.assigned_to = '';


current.opened_by   = GetIDValue('sys_user', 'New-Starter-Process');




if(email.body.FirstName != undefined) {


  current.short_description = email.body.FirstName;


}




current.insert();



Body of the email the if statement is looking at



A new starter request has been submitted. Please find the details below :


Timestamp :


Username :


First Name : Steve


Last Name :


Role Title :


HR or MRA Reference No.* :


First Name :


Last Name : ;


New Role Title :


Department Name or RAD :


Base Office :


Start Date :


marcguy
ServiceNow Employee
ServiceNow Employee

are you able to change the body of the email from First Name to First_Name?



then change your code to:



if(email.body.First_Name != undefined) {


  current.short_description = email.body.First_Name;


}



As the others said, javascript really doesn't like spaces when it's looking for specific values.


Hi,



Thanks for the response. So I have made the changes to the script and to the inbound email to change the space to a _ (I have also tried FirstName with no space) and still the short description is blank. My script is below. If anyone can spot an obvious error please let me know.



if(email.body.FirstName != undefined) {


current.short_description = email.body.First_Name ;


}


current.insert();



Regards


marcguy
ServiceNow Employee
ServiceNow Employee

Is it FirstName or First_Name because on both lines you have it different. Correct that to the correct parse value and you should be good.


Marc