record.create(options)
Method Description |
Creates a new record. When you create records of certain types, you can use the
Make sure that you check for supported default values as you create records. For a list of available record default values, see N/record Default Values.
Note:
For the promise version of this method, see record.create.promise(options). Note that promises are only supported in client scripts. |
Returns |
|
Supported Script Types |
Client and server 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. This value determines the Record.type property of the record that is created. This property is read-only on an existing record. Use the following guidelines:
|
2015.2 |
|
boolean |
optional |
Determines whether the new record is created 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 null. For a list of available record default values, see N/record Default Values in the NetSuite Help Center. |
2015.2 |
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 script example, see N/record Module Script Samples.
// Add additional code
...
// Start the process of creating a sales order record.
var objRecord = record.create({
type: record.Type.SALES_ORDER,
isDynamic: true,
defaultValues: {
entity: 87
}
});
// Start the process of creating an instance of a custom record type.
var customRecord = record.create({
type: 'customrecord_feature',
isDynamic: true
});
// Create a record with two default values
record.create({
type: record.Type.SALES_ORDER,
defaultValues: {
entity: 107,
subsidiary: 1
}
});
...
// Add additional code