Record.save(options)

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Submits a new record or saves edits to an existing record.

When working with records in standard mode, you must submit and then load the record to obtain sourced, validated, and calculated field values.

This method is not available to subrecords.

Note:

This method has an asynchronous counterpart you can use with client scripts. See Record.save.promise(options).

Returns

A number representing the internal ID of the new or updated record.

Supported Script Types

Client and server scripts

For more information, see SuiteScript 2.x Script Types.

Governance

Transaction records: 20 units

Custom records: 4 units

All other records: 10 units

Module

N/record Module

Sibling Object Members

Record Object Members

Since

2015.2

Parameters
Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

Since

options.enableSourcing

boolean

optional

Enables sourcing during the record update.

If set to true, sources dependent field information for empty fields.

Defaults to false – dependent field values are not sourced.

Important:

This parameter applies to records in standard mode only. When working with records in dynamic mode, field values are always sourced and the value you provide for enableSourcing is ignored. See SuiteScript 2.x Standard and Dynamic Modes.

2015.2

options.ignoreMandatoryFields

boolean

optional

Disables required field validation for this save operation.

If set to true, all standard and custom fields that are required through customization are ignored. All fields that are required through company preferences are also ignored.

By default, this parameter is false.

Important:

Use the ignoreMandatoryFields argument with caution. This argument should be used mostly with Scheduled scripts, rather than User Event scripts. This ensures that UI users do not bypass the business logic enforced through form customization.

2015.2

Syntax
Important:

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
...
var recordId = objRecord.save({
    enableSourcing: true,
    ignoreMandatoryFields: true
});
...
// Add additional code 

        

Related Topics

record.Record
N/record Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices