Submit Fields Programmatically with SuiteScript in NetSuite
Submit fields programmatically using SuiteScript in NetSuite, enabling efficient updates without loading parent records.
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:
| Parameter | Type | Required / Optional | Description |
|---|---|---|---|
options.type | String | Required | Specifies the record type. Use record.Type enum for standard records; use the custom record type's string ID for custom records. |
options.id | Number | String | Required |
options.values | Object | Required | An 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.options | Object | Optional | Additional 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:
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 : true11 }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 field31 'custbody_target_market': '1' // multi-select field32 }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.
Key Takeaways
- Use
record.submitFieldsto 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?
What script types are compatible with the record.submitFields method in NetSuite?
How do governance units vary when using the record.submitFields method?
What happens if a required argument is missing when using the record.submitFields method?
Was this article helpful?
More in SuiteScript
- SuiteScript 2.1 Enhancements in NetSuite February Updates
SuiteScript 2.1 now supports async features and PATCH method. Discover the latest API and SuiteProcurement improvements.
- Scheduling Map/Reduce Script Deployments in NetSuite
Learn to schedule map/reduce script submissions, including one-time and recurring options in NetSuite.
- Binary File Support in N/https Module for SuiteScript
SuiteScript enhances capabilities with binary file support in the N/https module, allowing improved data handling in external communications.
- API Governance Units Calculation in NetSuite 2026.1
NetSuite 2026.1 introduces examples illustrating API governance unit calculations for both user event and scheduled scripts.
