currentRecord.commitLine Method in SuiteScript Client Scripts
The currentRecord.commitLine method allows committing selected sublist lines in SuiteScript custom client scripts efficiently.
The currentRecord.commitLine method is an essential function used in SuiteScript 2.x client scripts to submit currently selected lines on a sublist. This method simplifies data handling on forms and ensures that any changes are accurately recorded within the NetSuite environment.
Method Description
The commitLine method commits the currently selected line in a specified sublist to the record. It is crucial for maintaining data integrity, especially when users interact with line item data.
Returns
This method returns the current currentRecord.CurrentRecord object that invoked the method, allowing further manipulations or inquiries post-commit.
Supported Script Types
- Client scripts
For more details, refer to the SuiteScript 2.x Script Types.
Governance
- None required.
Module
This method is part of the N/currentRecord Module.
Parent Object
The method is associated with the currentRecord.CurrentRecord object.
Parameters
The options parameter must be provided as a JavaScript object:
| Parameter | Type | Required / Optional | Description |
|---|---|---|---|
options.sublistId | string | Required | The internal ID of the sublist to commit. |
options.ignoreRecalc | boolean | Optional | If set to true, scripting recalculation is ignored. |
(Values for the parameters must be defined. Refer to the Records Browser for details on sublist IDs.)
Errors
When using this method, the following error codes may be thrown:
- SSS_INVALID_SUBLIST_OPERATION: Indicates that a required argument is invalid or that the sublist isn’t editable.
- SSS_MISSING_REQD_ARGUMENT: Thrown when a required argument is either missing or undefined.
Syntax Example
Here is the syntax for using the commitLine method. Note that while this code does show the syntax, it is not a full functional example.
1// Sample Code 2...3objRecord.commitLine({4 sublistId: 'item'5});6...7// Additional CodeTip: Ensure that the sublistId you provide is valid and that the line in the sublist can be edited, or you may encounter errors.
Additional References
- currentRecord.CurrentRecord
- N/currentRecord Module
- SuiteScript 2.x Modules
- SuiteScript 2.x
Key Takeaways
- The
commitLinemethod efficiently handles sublist line data in client scripts. - Proper parameters must be provided to avoid errors during execution.
- The method returns the invoking
currentRecordobject, allowing further manipulations.
Frequently Asked Questions (4)
Do I need to enable any feature flags to use the currentRecord.commitLine method?
Can I use the commitLine method with any kind of sublist in a client script?
What happens if I set ignoreRecalc to true when using the commitLine method?
What errors should I handle when using the commitLine method in my script?
Was this article helpful?
More in Platform
- Style Object Members for Workbook API in NetSuite
The Style object provides customizable properties for workbook formatting in NetSuite, enhancing report and visualization functionality.
- Asynchronous HTTP Requests with SuiteScript Promises
Use SuiteScript to send asynchronous HTTP requests with promises for efficient error handling and response processing.
- Setting Sublist Field Values in SuiteScript
Set values for sublist fields in SuiteScript using the setSublistValue method. Understand required parameters and error handling.
- In This Help Topic
Explore N/log module guidelines, log levels, and script execution logs for efficient logging in SuiteScript.
Advertising
Reach Platform Professionals
Put your product in front of NetSuite experts who work with Platform every day.
Sponsor This Category