
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2019 04:22 AM
Incoming emails from an external vendor inside an incident are not shown as Received in the activity log. Only our sent emails are shown. The body text from the received email shows up as a comment though.
But why would that matter if the comment still shows? Because we want to be able to answer to that received email because we Need the vendors subject line. This subject line contains the vendor ticket number which is crucial for the vendor's inbound action to work.
Could the reason for the received email not showing be because of the Inbound Action not really triggering like it should? :
The inbound action script looks like this (notice the gr.update() which should update the incident):
// Implement email action here
gs.include('validators');
// Find Company Ticket Number from Subject Line
var subject = email.subject;
var findStr = subject.indexOf("Ticket from Company:");
// If "Ticket from Company" is found in the Subject line, take out the INC number after it
if (findStr > -1) {
var endStr = subject.substring(findStr,subject.length); // Return everything from after findStr
var array = endStr.split(" "); // Split string into array
var customerNo = array[3].trim().toString(); // Take index 1 which is the INC number, trim and display as string
// Query the INC number on the Incident table
var gr = new GlideRecord('incident');
gr.addQuery('number',customerNo);
gr.query();
// If a matching Incident record is found, update the record
if (gr.next()) {
gr.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;
if (email.body.assign != undefined)
gr.assigned_to = email.body.assign;
if (email.body.priority != undefined && isNumeric(email.body.priority))
gr.priority = email.body.priority;
if (email.body.category != undefined)
gr.category = email.body.category;
if (email.body.short_description != undefined)
gr.short_description = email.body.short_description;
gr.update();
}
}
What am I missing in my Inbound Action to show the received email in the incident activity log? Or is it something else I need to adjust?
Is there any other user-friendly way we can answer to the received email?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2019 06:40 AM
By adding the following syntax to the end of my Inbound action script, I was able to force the Target to the incident record from the GlideRecord query (since normally only current records get a target):
sys_email.instance = gr.sys_id;
sys_email.target_table = gr.getTableName();
This allows me to pick up the received emails inside the Incident.
I still didn't have access to the Reply / Reply All / Forward buttons so I had to both
- Activate the email_reply UI macro
- Create a new sys_property glide.ui16.emailStreamResponseActions and set it to True
This made the Reply / Reply All / Forward button visible. So far so good.
But now that I have access to these Reply / Reply All / Forward button, they doesn't behave like I want them to. The To field is empty if I press Reply. Here it should set the sender's email address automatically. There should also be a RE: prefix in the subject line because I'm replying.
Since this is starting to become a new subject and a different question, I created a new post for how to deal with these buttons.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2019 04:53 AM
https://[INSTANCE].service-now.com/sys_email_list.do?sysparm_query=sys_created_onONToday%40javascript%3Ags.daysAgoStart(0)%40javascript%3Ags.daysAgoEnd(0)
Have a look into the email object itself and the target field, this should be the referenced incident.
The history of the incidents just shows the emails which are targeted to this incdent.
You may have to update the email object with the correct target which you found in the inbound action.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2019 05:42 AM
It seems like the Target field is not set because I don't make use of current and instead use gr
But how should I combine a GlideRecord query and current?
Edit: Looks like it's possible to override the target according to this blog article

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2019 06:40 AM
By adding the following syntax to the end of my Inbound action script, I was able to force the Target to the incident record from the GlideRecord query (since normally only current records get a target):
sys_email.instance = gr.sys_id;
sys_email.target_table = gr.getTableName();
This allows me to pick up the received emails inside the Incident.
I still didn't have access to the Reply / Reply All / Forward buttons so I had to both
- Activate the email_reply UI macro
- Create a new sys_property glide.ui16.emailStreamResponseActions and set it to True
This made the Reply / Reply All / Forward button visible. So far so good.
But now that I have access to these Reply / Reply All / Forward button, they doesn't behave like I want them to. The To field is empty if I press Reply. Here it should set the sender's email address automatically. There should also be a RE: prefix in the subject line because I'm replying.
Since this is starting to become a new subject and a different question, I created a new post for how to deal with these buttons.