- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2016 07:44 PM
I would like an inbound action to check the extension of an attachment to make sure it is .xls otherwise throw an error.
Can i use content_type?
Any help appreciated
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2016 10:34 PM
Try this
var getCurrentMail = new GlideRecord('sys_email');
getCurrentMail .get('uid', email.uid);
var emailSYSID = getCurrentMail.sys_id.toString();
var checkAttachment = new GlideRecord('sys_attachment');
checkAttachment.addQuery('table_sys_id', emailSYSID);
checkAttachment.addQuery('file_name','CONTAINS', '.xls');
checkAttachment.query();
if(checkAttachment.next()){
//Email Has Excel
}
else{
//Email Has No Excel
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2016 09:02 PM
Use the filename column for your query
file_nameLIKE.xls
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2016 09:11 PM
Thanks for your response... so can you do this within an inbound action like below:
if (email.file_nameLIKE.xls){
gs.eventQueue("invalid.attachment",current,email.subject, null) ;
event.state="stop_processing";
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2016 09:54 PM
Let me check and get back to you. I do not think we can get the filename directly using any variable

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2016 10:34 PM
Try this
var getCurrentMail = new GlideRecord('sys_email');
getCurrentMail .get('uid', email.uid);
var emailSYSID = getCurrentMail.sys_id.toString();
var checkAttachment = new GlideRecord('sys_attachment');
checkAttachment.addQuery('table_sys_id', emailSYSID);
checkAttachment.addQuery('file_name','CONTAINS', '.xls');
checkAttachment.query();
if(checkAttachment.next()){
//Email Has Excel
}
else{
//Email Has No Excel
}