SuiteScript 1.0 to 2.1 reference
nlapiSendEmail in SuiteScript 2.1
In SuiteScript 2.1, nlapiSendEmail is replaced by email.send from N/email. Sends an email and can attach it to records.
Before and after
// SuiteScript 1.0
nlapiSendEmail(-5, 'ops@acme.example', 'Order held', body, null, null, { transaction: 123 });// SuiteScript 2.1
define(['N/email'], (email) => {
email.send({
author: -5,
recipients: ['ops@acme.example'],
subject: 'Order held',
body,
relatedRecords: { transactionId: 123 },
});
});What to watch for
- The records object becomes relatedRecords with keys like transactionId and entityId.
- author must be an employee internal id, as in 1.0.
Related functions
- nlapiRequestURL becomes https.get / https.post / https.request
- nlapiResolveURL becomes url.resolveRecord / url.resolveScript
- nlapiStringToDate becomes format.parse / format.format
- All SuiteScript 1.0 functions
Find what still needs converting
Find every script that still calls nlapiSendEmail
SuiteMigrate lists the active 1.0 and 2.0 scripts in your NetSuite account, shows which ones you can read and which are locked, and drafts 2.1 conversions you review before deploying. Free for 5 conversions.
Examples are simplified. Test converted code in a NetSuite sandbox before deploying. SuiteMigrate is not affiliated with Oracle or NetSuite.