record.load.promise(options)
Method Description |
Loads an existing record asynchronously.
Note:
The parameters and errors thrown for this method are the same as those for record.load(options). For more information about promises, see Promise Object. |
Returns |
|
Synchronous Version |
|
Supported Script Types |
Client scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
Transaction records: 10 units Custom records: 2 units All other records: 5 units |
Module |
|
Since |
2015.2 |
Parameters
The options
parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
Since |
---|---|---|---|---|
|
string |
required |
The record type. Use the following guidelines:
|
2015.2 |
|
number |
required |
The internal ID of the existing record instance in NetSuite. The internal ID of the record is displayed on the list page for the record type. |
|
|
boolean |
optional |
Determines whether the record is loaded in dynamic mode.
By default, this value is
Note:
For additional information about standard and dynamic mode, see record.Record and SuiteScript 2.x Standard and Dynamic Modes. |
2015.2 |
|
Object |
optional |
Name-value pairs containing default values of fields in the new record. By default, this value is empty. |
|
Errors
Error Code |
Thrown If |
---|---|
|
A required argument is missing or undefined. |
Syntax
The following code sample shows the syntax for this member. It is not a functional example. For a complete promise script example, see Promise Object.
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