Modules

filter

 

Objects/Functions

module (N/record)

SuiteScript 2.0

record.copy.promise(options)

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

N/record Module
record.copy.promise()
Method Description: Creates a new record asynchronously by copying an existing record in NetSuite. The parameters and errors thrown for this method are the same as those for record.copy(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 records: 5 units
Module: N/record Module
Since: 2015.2
Search NetSuite - https://system.netsuite.com/app/help/helpcenter.nl?search=record.copy.promise(options)

Example:

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

// Copy an instance of a standard record type.

var copyRecordPromise = record.copy.promise({
type: record.Type.PHONE_CALL,
id: 165
});

// Note: To copy an instance of a custom record type,
// use the record type's string ID instead of the record
// module's Type enum. For example:
// type: 'customrecord_feature'



copyRecordPromise.then(function(recordObject) {

recordObject.setValue({
fieldId: 'title',
value: 'Sprint 5 bug triage'
});

recordObject.setValue({
fieldId: 'message',
value: 'Please review the PowerPoint prior to the call.'
});

var recordId = recordObject.save();

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

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_4440821922.html