Submit Fields Programmatically with SuiteScript in NetSuite

Submit fields programmatically using SuiteScript in NetSuite, enabling efficient updates without loading parent records.

·3 min read·View Oracle Docs

Starting in NetSuite, the record.submitFields method provides a streamlined approach to update and submit body fields on existing records. This method allows developers to make adjustments without needing to load or submit the parent record directly. It is particularly useful for making quick changes to standard or custom fields that support inline editing.

What Can You Update?

This method can be utilized to edit and submit the following:

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

Limitations

However, the record.submitFields method cannot be used to modify:

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

Return Value

Upon successful submission, this method returns the internal ID of the parent record that has been updated.

Supported Script Types

The record.submitFields method works with both client scripts and server scripts. This makes it versatile for a variety of use cases in NetSuite.

Governance

The governance units consumed by this method vary based on the type of record being updated:

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

Parameters

The options parameter is a JavaScript object that contains the following fields:

ParameterTypeRequired / OptionalDescription
options.typeStringRequiredSpecifies the record type. Use record.Type enum for standard records; use the custom record type's string ID for custom records.
options.idNumberStringRequired
options.valuesObjectRequiredAn object of ID-value pairs for fields you want to edit. The value type must match the field type (e.g., strings for text, booleans for checkboxes, etc.).
options.optionsObjectOptionalAdditional options for the record, such as enabling sourcing or ignoring mandatory fields during submission.

Example Usage

Here are some sample usages of the record.submitFields method:

suitescript
1// Submit a new value for a sales order's memo field.
2var id = record.submitFields({
3 type: record.Type.SALES_ORDER,
4 id: 1,
5 values: {
6 memo: 'ABC'
7 },
8 options: {
9 enableSourcing: false,
10 ignoreMandatoryFields : true
11 }
12});
13
14// Submit a new value for a field on a custom record type.
15var otherId = record.submitFields({
16 type: 'customrecord_book',
17 id: '4',
18 values: {
19 'custrecord_rating': '2'
20 }
21});
22
23// Submit a record with both select and multi-select fields.
24var thirdID = record.submitFields({
25 type: record.Type.SALES_ORDER,
26 id: 21882,
27 values: {
28 'custbodycust_txt_fld_custso': 'Hello from custom field',
29 'memo': 'Hello from memo',
30 'leadsource': 254, //leadsource is a select field
31 'custbody_target_market': '1' // multi-select field
32 }
33});

Errors

If a required argument is missing, the following error code will be thrown:

  • SSS_MISSING_REQD_ARGUMENT: Indicates that a required argument is missing or undefined.

Conclusion

The record.submitFields method simplifies the updating process in NetSuite, allowing quick edits while observing governance limitations. It plays a key role in enhancing the user experience by improving the efficiency of record management.

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

Key Takeaways

  • Use record.submitFields to update records without loading parent records.
  • Supports inline editing for standard and custom body fields.
  • Cannot be used to alter sublist or subrecord fields.
  • Consumes different governance units based on record type.
  • Provides flexibility for client and server-side script implementations.

Frequently Asked Questions (4)

Can the record.submitFields method be used to update sublist line item fields?
No, the record.submitFields method cannot be used to update sublist line item fields or subrecord fields such as address fields.
What script types are compatible with the record.submitFields method in NetSuite?
The record.submitFields method is compatible with both client scripts and server scripts, providing versatility across different use cases.
How do governance units vary when using the record.submitFields method?
The governance units vary based on the type of the record: 10 units for transaction records, 2 units for custom records, and 5 units for all other records.
What happens if a required argument is missing when using the record.submitFields method?
If a required argument is missing, an error with the code SSS_MISSING_REQD_ARGUMENT will be thrown, indicating that the argument is missing or undefined.
Source: Syntax 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 Administration

View all Administration articles →