Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SuiteScript 2 Email Invoices

Hi and I I am not a pain, I got help on sending a statement and that worked perfectly, but I need to send invoices with it but I can't find a method for that like I did for the statement. I find references to using a template file, then you have to store the file in the cabinet. I have to attach there to emails, what would you think the best way to do this?

Here is the other link, he gave a very helpful complete answer about sending statements. I should have asked him about invoices at the same time but I didn't think of it, apologies.

SuiteScript 2 can send pdf statements

added additional info Ok I tried this but I am getting an error that doesn't make sense as I am using their templates. "error.SuiteScriptError","name":"USER_ERROR","message":"Error Parsing XML: The reference to entity \"c\" must end with the ';' delimiter.",

require(['N/render', 'N/file', 'N/record'],
function(render, file, record) {
function renderRecordToPdfWithTemplate() {

var renderer = render.create();
renderer.setTemplateByScriptId("STDTMPLCUSTINVC");
var xml = renderer.renderAsString();

renderer.addRecord(record.Type.INVOICE, record.create({
type: record.Type.INVOICE,
id:415619
}));
var invoicePdf = renderer.renderAsPdf();

var foo = this;

}
renderRecordToPdfWithTemplate();
});

thanks for any help with this

like image 200
jk121960 Avatar asked Jul 14 '26 20:07

jk121960


1 Answers

Ok I found it thanks if anyone was looking for this for me. It is pretty straightforward, but like NetSuite always is, you have to find it. :) the entityid is the invoice internalid the rest is easy, then just pass the file object to the email.

require( [ 'N/render', 'N/file', 'N/record' ],
function( render, file, record ) {
function renderRecordToPdfWithTemplate() {


var transactionFile = render.transaction({
    entityId: 415619,
    printMode: render.PrintMode.PDF
});

var foo = this;

}

renderRecordToPdfWithTemplate();
} );

thanks again

like image 170
jk121960 Avatar answered Jul 19 '26 02:07

jk121960



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!