Modules
Objects/Functions
SuiteScript 2.0
{record}.load.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.load.promise()
Method Description:
Loads an existing record asynchronously.
The parameters and errors thrown for this method are the same as those for record.load(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.load.promise(options)
Example:
// Code Example 1
function loadRecord() {
// Load an instance of a standard NetSuite record
// type.
var loadRecordPromise = record.load.promise({
type: record.Type.PHONE_CALL,
id: 712
});
// Note: To load an instance of a custom record type,
// use the record type's string ID. For example:
// type: 'customrecord_feature'
loadRecordPromise.then(function(objRecord) {
objRecord.setValue({
fieldId: 'message',
value: 'We will start the call with a restrospective.'
});
var recordId = objRecord.save();
// Add any other needed logic that shouldn't execute
// until after the record is instantiated.
log.debug({
title: 'Record updated',
details: 'Updated record ID: ' + recordId
});
}, function(e) {
log.error({
title: 'Unable to load record',
details: e.name
});
});
}
//...
// Add additional code.
//SOURCE: https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4440830173.html