SuiteScript 1.0 to 2.1 reference
nlapiTransformRecord in SuiteScript 2.1
In SuiteScript 2.1, nlapiTransformRecord is replaced by record.transform from N/record. Creates a record from another one, for example an invoice from a sales order.
Before and after
// SuiteScript 1.0
var inv = nlapiTransformRecord('salesorder', 123, 'invoice');
var invId = nlapiSubmitRecord(inv);// SuiteScript 2.1
define(['N/record'], (record) => {
const inv = record.transform({
fromType: record.Type.SALES_ORDER,
fromId: 123,
toType: record.Type.INVOICE,
});
const invId = inv.save();
});What to watch for
- Transform defaults from 1.0's fourth argument go in defaultValues.
Related functions
- nlapiSearchRecord becomes search.create
- nlapiLoadSearch becomes search.load
- nlapiGetFieldValue becomes getValue
- All SuiteScript 1.0 functions
Find what still needs converting
Find every script that still calls nlapiTransformRecord
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.