How to email a specific pdf file from file cabinet as attachment to a specific recipient?
I have over 100 PDF files saved in my file cabinet with a different name or email address. I want to automatically email those files as attachments to the recipients whose email id is mentioned as the name of the PDF files.
How can I do this in NetSuite? Kindly help me in this regard.
This depends on the setup of your filing cabinet.
You can have a Map/Reduce script that searches for all PDFs in the filing cabinet, but I imagine you would have other PDFs you didn’t want to send emails for.
So if all of the PDFs you would like to send are in one folder, you can use a Map/Reduce script with a file search to find all of the PDFs within a specific folder(s).
For each PDF you will need to use string manipulation to get the email ID, then send the email using the N/email module.
You are probably best moving the PDF to a separate folder within the Filing Cabinet once the email has been sent to avoid sending out the same email twice.
Again, much of what I mentioned above depends on how the Filing Cabinet is set up and the format of the PDF names.
I am new in coding so Can you please write a code for me ?
I cannot write the code for you, as I don’t know the specifics of your system and also this would take a considerable amount of time.
Perhaps there is a kind individual on this site that might be able to write the code for you, otherwise, I would look at getting an in-house developer to handle this and future requests for you.
Okay, Can you please just make changes in below code based on my requirements?
var fileSearch = nlapiSearchRecord(“file”,null,
for (var i = 0; fileSearch != null && i < fileSearch.length; i++)
//Get result values
var searchresult = fileSearch[i];
var record = searchresult.getId();
var rectype = searchresult.getRecordType();
var name = searchresult.getValue(‘name’);
var resolution = searchresult.getValue(‘url’);