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:

  • Standard body fields that support inline editing (direct list editing). For more information, see Using Inline Editing.

  • Custom body fields that support inline editing.

  • Select and multi-select fields

You cannot use this method to edit and submit the following:

  • Sublist line item fields

  • Subrecord fields (for example, address fields)

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

N/record Module

Since

2015.2

Parameters
Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

Since

options.type

string

required

The record type.

Use the following guidelines:

  • When working with an instance of a standard NetSuite record type, set this value by using the record.Type enum.

  • When working with an instance of a custom record type, set this value by using the custom record type’s string ID. For help finding this ID, see Custom Record.

2015.2

options.id

number | string

required

The internal ID of the existing record instance in NetSuite.

2015.2

options.values

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:

  • Text, Radio, Select and Multi-Select fields accept string values.

  • Checkbox fields accept boolean values.

  • Date and DateTime fields accept Date values.

  • Integer, Float, Currency and Percent fields accept number values.

2015.2

options.options

Object

optional

Additional options to set for the record.

2015.2

options.options.enablesourcing

boolean

optional

Indicates whether to enable sourcing during the record update.

By default, this value is true.

2015.2

options.options.ignoreMandatoryFields

boolean

optional

Indicates whether to ignore required fields during record submission.

By default, this value is false.

2015.2

Errors

Error Code

Thrown If

SSS_MISSING_REQD_ARGUMENT

A required argument is missing or undefined.

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
...

// 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 

        

Related Topics

General Notices