How would i check the extension of an attachment in an inbound action?

Davina
Giga Contributor

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

1 ACCEPTED SOLUTION

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


}


View solution in original post

5 REPLIES 5

Thank you!!!