Modules

filter

 

Objects/Functions

module (N/record)

SuiteScript 2.0

record.create.promise(options)

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

N/record Module
record.create.promise()
Method Description: Creates a new record asynchronously. The parameters and errors thrown for this method are the same as those for record.create(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.create.promise(options)

Example:

// Code Example 1
// Add additional code.

//...
function createRecord() {

// Create an instance of a standard record record
// type.

var createRecordPromise = record.create.promise({
type: record.Type.PHONE_CALL,
isDynamic: true
});

// Note: To create 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'

createRecordPromise.then(function(objRecord) {
objRecord.setValue({
fieldId: 'title',
value: 'sprint planning'
});

var recordId = objRecord.save();



log.debug({
title: 'New record saved',
details: 'New record ID: ' + recordId
});

}, function(e) {
log.error({
title: 'Unable to create record',
details: e.name
});
});
}
//...
// Add additional code.

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