- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2018 09:19 AM
Hello Community!
I am running an inbound email action to parse out an email. I am then using the set display value method on variables on my form that it creates. Some variables are filling in and working and some are not. I am hoping you can help me figure out why. Below is a copy of my inbound email action, and some form info. One weird thing that is happening is that it will set the job title to a value like a string, but you can't see it on the form and it's not referencing that table.
INBOUND EMAIL
--------------------------------------------------------------------------------------------------------------------------
Hello IT Service Desk,
This is a request for IT to setup for the new hire.
New Hire Name: Emily M Vranes
New Hire/Rehire: Yes - New Hire
Position: Customer Support Rep Level I
Department: Client Support - UT
Location: Draper Headquarters
Needs Laptop: No
Orientation Date: 2018-08-06
Start Date: Monday, August 06, 2018
Reporting Manager: Eva Ariceaga
Manager's email: ***.****@****leasing.com
Thank you,
HR Department
--------------------------------------------------------------------------------------------------------------------------
INBOUND EMAIL ACTION
var email_string = email.body_text.toString();
var names = email.body.new_hire_name.toString().split(' ');
var username = email.body.new_hire_name;
var manager = email.body.reporting_manager;
var location = email.body.location;
var job_title = email.body.position;
var department = email.body.department;
var needs_laptop = email.body.needs_laptop;
var start_date = email.body.orientation_date;
var email_sys_id = sys_email.sys_id;
current.initialize();
current.u_new_hire_manager = manager;
if (names.length == 2)
{
current.u_first_name = names[0];
current.u_last_name = names[1];
}
if (names.length == 3)
{
current.u_first_name = names[0];
current.u_last_name = names[2];
}
current.u_username = username;
current.u_location.setDisplayValue(email.body.location);
current.u_job_title.setDisplayValue(email.body.position);
current.u_department.setDisplayValue(email.body.department);
if (needs_laptop == 'Yes')
{
current.u_needs_laptop = true;
}
if (needs_laptop == 'No')
{
current.u_needs_laptop = false;
}
current.u_start_date = start_date;
current.description = email_string;
current.state = 1;
current.assignment_group = '3adacb8813ad6e00d9ff30ded144b011';
current.short_description = 'New Hire Onboarding - ' + username;
current.reference_email = email_sys_id;
current.insert();
THE CREATED RECORD FROM THE INBOUND ACTION
I filled in Location, Start Date, Job Title, and Department. Those are the fields that are not auto filling, every other field is auto filling from my inbound action. Any tips or help or questions would be great, thank you!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2018 12:24 PM
the freaking email that we were getting sent had " " spaces in front (face palm) just added .trim() to my variables that were not mapping over, and that fixed it!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2018 09:26 AM
Can you add some logs? When you use display value, it should match the exact text in the reference table
var email_string = email.body_text.toString();
var names = email.body.new_hire_name.toString().split(' ');
var username = email.body.new_hire_name;
var manager = email.body.reporting_manager;
var location = email.body.location;
var job_title = email.body.position;
var department = email.body.department;
var needs_laptop = email.body.needs_laptop;
var start_date = email.body.orientation_date;
var email_sys_id = sys_email.sys_id;
current.initialize();
current.u_new_hire_manager = manager;
if (names.length == 2)
{
current.u_first_name = names[0];
current.u_last_name = names[1];
}
if (names.length == 3)
{
current.u_first_name = names[0];
current.u_last_name = names[2];
}
current.u_username = username;
gs.info('+++++++++email.body.location is '+email.body.location);
gs.info('+++++++++email.body.position is '+email.body.position);
gs.info('+++++++++email.body.department is '+email.body.department);
current.u_location.setDisplayValue(email.body.location);
current.u_job_title.setDisplayValue(email.body.position);
current.u_department.setDisplayValue(email.body.department);
if (needs_laptop == 'Yes')
{
current.u_needs_laptop = true;
}
if (needs_laptop == 'No')
{
current.u_needs_laptop = false;
}
current.u_start_date = start_date;
current.description = email_string;
current.state = 1;
current.assignment_group = '3adacb8813ad6e00d9ff30ded144b011';
current.short_description = 'New Hire Onboarding - ' + username;
current.reference_email = email_sys_id;
current.insert();
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2018 10:06 AM
Thanks for the reply, how can I add some logs to that and where do I get those logs to post here? yeah, they all are in the table. We just cloned our production instance back to our RC instance and I was able to test an onboarding email like above in RC and everything worked fine. We just cloned back over the weekend.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2018 10:08 AM
The script I posted, I added the logs to it. You just need to use that script. After sending an inbound email, check the system logs and you should see those logs.
gs.info('+++++++++email.body.location is '+email.body.location);
gs.info('+++++++++email.body.position is '+email.body.position);
gs.info('+++++++++email.body.department is '+email.body.department);
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2018 09:41 AM
Hi,
Please check if these values exists in referencing table.
Thanks