Checking if an inbound email has an attachment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2011 09:00 PM
Hi,
Below is a snippet that you can use to check if an email has an attachment.
This particular example is used from an inbound email action.
//Query the sys_email table so we can get the logged email's sys id, this is used later to look for attachments.
var email_log = new GlideRecord('sys_email');
email_log.addQuery('uid', email.uid); //Since we are calling this from an inbound email action, we need to lookup this incoming uid in the sys_email table.
email_log.query();
//Make sure we can find the email in the email log
if (email_log.next()) {
//Query our attachment table
var attachLog = new GlideRecord('sys_attachment');
attachLog.addQuery('table_sys_id', email_log.sys_id);
attachLog.addQuery('table', 'sys_email');
attachLog.query();
if (attachLog.next()) {
//Do Stuff
}
}
- 2,596 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2011 09:58 AM
Thank you for sharing!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2011 10:36 AM
Thanks !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2019 09:50 PM
Helpful, thank you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-01-2020 07:59 AM
Worked like a charm. Thank you