Solution
Below code defines capturing attachment from the email and saving to the file Cabinet. And calling the suitelet to perform other actions.
function process(email)
{
nlapiLogExecution('DEBUG','Email Plugin Triggered');
var attachments = email.getAttachments();
if (attachments != null)
{
for (var a in attachments)
{
var attachment = attachments[a];
var csvFolder=3190658 // Folder Id
attachment.setFolder(csvFolder);
var body={"csvFolder":csvFolder}
var fileId = nlapiSubmitFile(attachment);
var url = nlapiResolveURL("SUITELET", "customscript_jj_sl_sndcsv_gcs_xseed465", "customdeploy_jj_sl_sndcsv_gcs_xseed465", "external");
var response = nlapiRequestURL(url, JSON.stringify(body), {}, null,'POST' );
} } }
To add this to NetSuite,
Go to Customizations>Plug-ins>Plug-in Implementations>New
Select the above script
Select Email Plugin>Add name and details> Release the script
Customizations>manage Plugins>Check Email Plugin>Copy email and send any file to this email.
The Email file will be saved to the file cabinet in NetSuite