This topic contains 3 replies, has 0 voices, and was last updated by AFTechSupport 7 years, 10 months ago.
-
AuthorPosts
-
January 9, 2017 at 9:29 pm #2276
AFTechSupportI am trying to combine multiple invoices into a single pdf which would then be emailed to the customer.
I looked up the forums and found some help. https://usergroup.netsuite.com/users…nto-1-pdf-file
Based on that this is what I have been trying so far.. The file that gets send is unreadable and most likely the encoding is all incorrect?
Below is the code
var statementFile1 = nlapiPrintRecord(‘TRANSACTION’, ‘5778’, ‘PDF’);
//statementFile1.setEncoding(‘UTF-8’); // doesnt help..
var statementFile2 = nlapiPrintRecord(‘TRANSACTION’, ‘5782’, ‘PDF’);
var statementFile3 = nlapiPrintRecord(‘TRANSACTION’, ‘5766’, ‘PDF’);
var xml = “nn”;
xml += “
“; xml += “
“; xml += “
“;xml += statementFile1.getValue();
xml += ““;
xml += ““;
xml += “
“; xml += “
“;xml += statementFile2.getValue();
xml += ““;
xml += ““;
xml += “
“; xml += “
“;xml += statementFile3.getValue();
xml += ““;
xml += ““;
xml += ““;
var xmlFile = nlapiXMLToPDF(xml);
var template = loadTemplate(6);
nlapiSendEmail(-5,’testemailaddress’,template.subject, template.body, null, null, null, xmlFile);
Have tried quite few things but all are prone to error. The only way which worked was generating all the table tags and all the html and adding that instead of statementFile1.getValue(); but this would mean generating all the html which I want to avoid.
Is there no simpler way?
This is a cached copy. Click here to see the original post. -
January 9, 2017 at 9:59 pm #2277
michoelTry using nlapiPrintRecord(‘TRANSACTION’, ‘5778’, ‘HTML’) instead of nlapiPrintRecord(‘TRANSACTION’, ‘5778’, ‘PDF’);
-
January 10, 2017 at 10:03 am #2278
B DouglasThis can also be done manually using ‘Print checks and forms – Invoices”.
Customize and add filters/columns for customer and status and any others as needed, will result in one PDF of all selected translations which can then be sent to the customer.
-
January 10, 2017 at 6:43 pm #2279
AFTechSupportThanks Michoel and B Douglas.
Using HTML instead of PDF started giving me more errors.
We need to be able to send Mass Emails hence downloading files first and then sending to all the customers would be too much work.
In SuiteAnswers found article id 37162: https://netsuite.custhelp.com/app/an…37162/kw/37162
The script gets the pdf file from nlapiPrintRecord and then stores the files in the netsuite file cabinet it then loads the file from the url and passes it as pdf source. Tested it. This works fine, I will just need to add code to delete the created files from the file cabinet after sending the emails.
Thanks for all your help.
-
AuthorPosts
You must be logged in to reply to this topic.