
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2017 11:37 AM
I need to capture the sys_id from an incoming email in a variable within an inbound action script. I can get email.body_text, email.subject, etc. but email.sys_id comes back as 'undefined'. email.getUniqueValue() doesn't work either (I didn't really expect it to) and I'm at a loss for what else to try.
Thanks in advance for any help.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- 7,001 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2017 11:47 AM
According to docs, it appears that you might be able to do something like sys_email.sys_id.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2023 02:43 AM
thx Robert! one more question: since the link you provided is not work, may i ask how can i find related documents (for example: i search keyword "sys_email" in https://docs.servicenow.com/ but it seems not that easy to find the information you've mentioned aboved)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2025 10:14 AM
sys_email.sys_id works for me inside of Inbound Email Action script. Thank you!
var emailGR = new GlideRecord('sys_email');
if (emailGR.get(String(sys_email.sys_id))) { // probably don't need the String
// use emailGR
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2024 01:58 AM - edited 01-19-2024 02:14 AM
(function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
try {
var greml = new GlideRecord('sys_email');
greml.addQuery('uid', email.uid);
greml.orderByDesc('sys_created_on');
greml.query();
if(greml.next()) {
var strbody = grml.body.toString();
gs.info('TEST:'+greml.sys_id);
}
...