record.submitFields(options)
Method Description |
Updates and submits one or more body fields on an existing record in NetSuite, and returns the internal ID of the parent record. When you use this method, you do not need to load or submit the parent record. You can use this method to edit and submit the following:
You cannot use this method to edit and submit the following:
Note:
For the promise version of this method, see record.submitFields.promise(options). Note that promises are only supported in client scripts. |
Returns |
The internal ID of the parent record. |
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. Use the following guidelines:
|
2015.2 |
|
number | string |
required |
The internal ID of the existing record instance in NetSuite. |
2015.2 |
|
Object |
required |
The ID-value pairs for each field you want to edit and submit. The value type must correspond to the field type being set. For example:
|
2015.2 |
|
Object |
optional |
Additional options to set for the record. |
2015.2 |
|
boolean |
optional |
Indicates whether to enable sourcing during the record update. By default, this value is |
2015.2 |
|
boolean |
optional |
Indicates whether to ignore required fields during record submission.
By default, this value is |
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
...
// Submit a new value for a sales order's memo field.
var id = record.submitFields({
type: record.Type.SALES_ORDER,
id: 1,
values: {
memo: 'ABC'
},
options: {
enableSourcing: false,
ignoreMandatoryFields : true
}
});
// Submit a new value for a field on an instance of the 'customrecord_book' custom record type.
var otherId = record.submitFields({
type: 'customrecord_book',
id: '4',
values: {
'custrecord_rating': '2'
}
});
// Submit a record with both select and multi-select fields
var thirdID = record.submitFields({
type: record.Type.SALES_ORDER,
id: 21882,
values: {
'custbodycust_txt_fld_custso': 'Hello from custom field',
'memo': 'Hello from memo',
'leadsource': 254, //leadsource is a select field
'custbody_target_market': '1' // custbody_target_market is a custom multi-select field
}
});
...
// Add additional code