/* * Inbound email action script for processing Attachments sent via Email. * Attaches to a data source, then runs a scheduled import against it. * Author: Paul.Senatillaka@fruitionpartners.com * Uses Script Include: AttachmentImportProcessor - Also by Fruition Partners */ //Settings - Update the data source with the appropriate SYS ID that has the Transform Map we want to use. var dataSourceSysId = '42686ebffdec29803750565f39c4cb74'; var validAttachments = ['application/vnd.ms-excel','text/csv']; //-----Do not need to change anything below this----- //Query for the sys_email record (incoming email) that contains the attachment and attach to data source var grEmailLog = new GlideRecord('sys_email'); grEmailLog.addQuery('uid', email.uid); grEmailLog.orderByDesc('sys_created_on'); grEmailLog.query(); if (grEmailLog.next()) { var processor = new AttachmentImportProcessor(grEmailLog, dataSourceSysId); processor.setAttachmentTypes(validAttachments); processor.processAttachments(); }