record.submitFields: Update Records Efficiently in NetSuite

The record.submitFields method allows easy updates to body fields on existing NetSuite records without loading the parent record.

·3 min read·View Oracle Docs

The record.submitFields method in NetSuite allows developers to update and submit body fields on existing records efficiently. This method is beneficial as it eliminates the need to load the parent record, streamlining data management processes.

Method Overview

What Does record.submitFields Do?

The method updates specified fields for a record and returns the internal ID of the parent record. The key advantage is that both standard and custom body fields that support inline editing can be modified. However, certain limitations exist regarding the types of fields that can be updated.

Editable and Non-Editable Fields

You can edit:

  • Standard body fields that support inline editing.
  • Custom body fields that support inline editing.
  • Select and multi-select fields.

You cannot edit:

  • Sublist line item fields.
  • Subrecord fields (like address fields).

Method Return Value

The method returns the internal ID of the parent record being updated, facilitating further operations if needed.

Script Compatibility

This method is compatible with both client and server scripts within the SuiteScript framework.

Governance

Usage of the method is governed based on the type of record being updated:

  • Transaction records: 10 units per call
  • Custom records: 2 units per call
  • All other records: 5 units per call

Parameters

The options parameter is a JavaScript object that includes several properties necessary for executing record.submitFields successfully:

ParameterTypeRequired/OptionalDescription
options.typestringRequiredIndicates the record type. Use record.Type enum for standard records; string ID for custom records.
options.idnumberstringRequired
options.valuesObjectRequiredKey-value pairs for fields to be updated, ensuring values are of the correct type.
options.optionsObjectOptionalAdditional options during the record update. Items include enableSourcing and ignoreMandatoryFields.

Example Usage

Here are some examples demonstrating how to utilize this method:

Update a Sales Order's Memo Field

suitescript
1var id = record.submitFields({
2 type: record.Type.SALES_ORDER,
3 id: 1,
4 values: {
5 memo: 'ABC'
6 }
7});

Update Custom Record Field

suitescript
1var otherId = record.submitFields({
2 type: 'customrecord_book',
3 id: '4',
4 values: {
5 'custrecord_rating': '2'
6 }
7});

Update Fields with Select and Multi-Select Types

suitescript
1var thirdID = record.submitFields({
2 type: record.Type.SALES_ORDER,
3 id: 21882,
4 values: {
5 'custbodycust_txt_fld_custso': 'Hello from custom field',
6 'memo': 'Hello from memo',
7 'leadsource': 254, // select field
8 'custbody_target_market': '1' // custom multi-select field
9 }
10});

Errors

Developers should be aware of error codes that may arise, specifically:

  • SSS_MISSING_REQD_ARGUMENT: This error is thrown when a required argument is missing or undefined during execution.

This method significantly enhances the efficiency of record management in NetSuite, giving developers more power over how they manipulate data.

Key Takeaways

  • The record.submitFields method allows efficient updates to NetSuite records.
  • Developers must specify record types and IDs to utilize this method correctly.
  • Different record types have varying governance limits regarding method usage.
  • This method does not allow updates to sublist or subrecord fields.
  • Developers should handle potential errors related to required arguments carefully.

Source: This article is based on Oracle's official NetSuite documentation.

Frequently Asked Questions (4)

Can the record.submitFields method in NetSuite be used to update sublist line item fields?
No, the record.submitFields method cannot be used to update sublist line item fields. It is only applicable for standard and custom body fields that support inline editing, as well as select and multi-select fields.
What are the governance limits for using record.submitFields on different types of records?
The governance limits for using record.submitFields are 10 units per call for transaction records, 2 units per call for custom records, and 5 units per call for all other records.
Is the enableSourcing option mandatory when using the record.submitFields method?
No, the enableSourcing option is not mandatory when using the record.submitFields. It's part of the additional options that can be included during the record update but is optional.
What happens if a required argument is missing when executing record.submitFields?
If a required argument is missing or undefined during the execution of record.submitFields, the method will throw an error code SSS_MISSING_REQD_ARGUMENT.
Source: Parameters Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in Integration

View all Integration articles →