- 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2018 10:06 AM
thanks for the reply! 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 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 10:26 AM
it seems reference fields are not populating in your target table.
Please make sure that you are inserting sys_id for reference field data in your inbound action code.
Please modify your code like below
ar 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;
var loc = new GlideRecord('cmn_location');
loc.addQuery('name',location);
loc.query();
while(loc.next()){
var lc = loc.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);// sys_id of location
current.u_location = lc;
current.u_job_title.setDisplayValue(email.body.position); // sys_id of job tilte
current.u_department.setDisplayValue(email.body.department); // sys_id of 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();
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2018 12:25 PM
thanks for you help on this.
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!