pingu
10/28/2021, 6:10 AM/**
* @NApiVersion 2.0
* @NScriptType UserEventScript
*/
define(['N/email','N/runtime'],
function(email,runtime) {
function afterSubmit(context) {
var currentUser = runtime.getCurrentUser().id;
var invoice = context.newRecord;
var invoiceId = invoice.getValue("tranid");
var emailbody = 'An invoice was created with and ID of '+invoiceId+'. Thank you!';
email.send({
author : currentUser,
recipients: currentUser,
subject: 'Invoice Created',
body: emailbody
});
}
return {
afterSubmit: afterSubmit
}
});
This script is supposed to send email for every invoice created. But I can't seem to receive an email from my suitescript. Anyone has any idea?michoel
10/28/2021, 6:12 AMpingu
10/28/2021, 6:14 AMRyan J
10/28/2021, 7:31 AMemail.send({
author: 123,
recipients: supplierEmail,
subject: 'PR ' + purchaseOrderRecord.memo + ' is now approved.',
body: 'Random stuff',
attachments: [generatedFile],
relatedRecords: {
transactionId: purchaseOrderRecord.id,
},
});
pingu
10/28/2021, 8:22 AM