Modules

filter

 

Objects/Functions

module (N/record)

SuiteScript 2.0

record.transform.promise(options)

{record}.transform.promise({fromType: {string*},fromId: {number*},toType: {string*},isDynamic: {boolean},defaultValues: {Object}}).then(function(response){// DO SOMETHING WITH RESPONSE HERE}, function(error){// DO SOMETHING WITH ERROR HERE});

N/record Module
record.transform.promise()
Method Description: Transforms a record from one type into another asynchronously, using data from an existing record. You can use this method to automate order processing, creating item fulfillment transactions and invoices off of orders. For a list of supported transformations, see Supported Transformation Types. The parameters and errors thrown for this method are the same as those for record.transform(options). For more information on promises, see Promise Object.
Returns: Promise Object
Supported Script Types: Client-side scripts For more information, see SuiteScript 2.0 Client Script Type.
Governance: Transaction records: 10 units Custom records: 2 units All other record types: 5 units
Module: N/record Module
Since: 2015.2
Search NetSuite - https://system.netsuite.com/app/help/helpcenter.nl?search=record.transform.promise(options)

Example:

// Code Example 1
// Add additional code.
//...
function transformRecord() {

var transformRecordPromise = record.transform.promise({
fromType: record.Type.ESTIMATE,
fromId: 25,
toType: record.Type.SALES_ORDER,
isDynamic: true,
});

transformRecordPromise.then(function(recordObject) {

var recordId = recordObject.save();

// Add any other needed logic that shouldn't execute until
// after the record is transformed.

log.debug({
title: 'Record saved',
details: 'Id of new record: ' + recordId
});

}, function(e) {

log.error({
title: e.name,
details: e.message
});
});
}
//...
// Add additional code.

//SOURCE: https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4440843375.html