How to extract email address from external email from email inbound action
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2024 10:55 PM
Hi Community
As per the subject, I'm trying to extract the external email address from the external source prior creating a HR case. The email address is then required to be appended to the short description. I've tried the code below however the variable return 'undefined'. Here is the code i wrote on the runAction
var rec = new GlideRecord('sys_user');
rec.addQuery('email',email.from);
if (rec.next()) {
var userEmail = rec.email; // Get the email if user record is found
} else {
var userEmail1 = "guest@example.com"; // Fallback if no user is found
}
// Check value
gs.info("User Email: " + userEmail + " "+ userEmail1);
current.comments = userEmail + " "+ userEmail1;
0 REPLIES 0