Gerry Crumbley
Giga Expert

I've tried this, but can't get it to work. I don't get any Email Body with it. This is the .eml attachment in the INC:

find_real_file.png

Here is the script:

// Note: current.opened_by is already set to the first UserID that matches the From: email address

(function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
// Implement email action here
var strEmailContent = email.content_type +"\n"+ email.headers + "\n\n\n\n"+ email.body;
var sa = new GlideSysAttachment();

current.caller_id = gs.getUserID();
current.comments = "forwarded by: " + email.origemail + "\n\n" + email.body_text;
current.short_description = email.subject;

current.category = "O365";
current.incident_state = IncidentState.NEW;
current.notify = 2;
current.contact_type = "email";

if (email.body.assign != undefined)
current.assigned_to = email.body.assign;

if (email.body.priority != undefined)
current.priority = email.body.priority;

// map fields that are mandatory or necessary'
sa.write(current, email.subject +".eml", " application/octet-stream ", strEmailContent);

current.insert();

})(current, event, email, logger, classifier);

 

Can someone tell me where the error is?