- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2017 10:38 AM
Hello!
In our instance (Helsinki), we currently have inbound emails generating Call records for our Service Desk to work and determine the appropriate path (Incident, Request, etc.).
On this inbound email action, I have attempted to add a script under the Action tab to attach the inbound email(.eml) to the Call record as an attachment. This is useful for our environment because in many situations the customer will cc others already working on, or have worked on in the past, whatever they are reporting or requesting. The Service Desk can view that original email and get a quick understanding of the escalation path for that record.
I am honestly a novice at scripting and I pull most of my scripts from the rock stars around this community! Do any of you have a few moments to take a look at the script below to let me know if I am completely out in left field with what I have up to this point?
var strEmailContent = email.content_type +"\n"+ email.headers;
strEmailContent += "\n\n\n\n"+ email.body;
var sa = new GlideSysAttachment();
sa.write(current, strFileName +".eml", " application/octet-stream ", strEmailContent);
Thank you so much for your time!
Nathan
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2017 11:53 AM
try this .It works for me .. it should work for you too
(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.short_description = email.subject;
current.description =email.body_text;
// map fields that are mandatory or necessary'
sa.write(current, email.subject +".eml", " application/octet-stream ", strEmailContent);
current.insert();
})(current, event, email, logger, classifier);
hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-13-2017 01:10 AM
Can we use it together with mobile-phone-tracker.org mobile recorder on Android?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2019 08:16 AM
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:
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-19-2021 01:26 PM
Hi Gerry,
I am facing the same issue. Were you able to fix this?
Regards,
Surabhi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2023 02:09 AM
Missing the '_text' when setting the strEmailContent
// 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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2024 01:11 AM
I'm still facing the same issue. PFA for the sample email attachment. I used this code also. Kindly anyone has workaround for this.
Regards,
Harini