currentRecord.commitLine Method in SuiteScript Client Scripts

The currentRecord.commitLine method allows committing selected sublist lines in SuiteScript custom client scripts efficiently.

·2 min read·View Oracle Docs

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:

ParameterTypeRequired / OptionalDescription
options.sublistIdstringRequiredThe internal ID of the sublist to commit.
options.ignoreRecalcbooleanOptionalIf 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.

suitescript
1// Sample Code
2...
3objRecord.commitLine({
4 sublistId: 'item'
5});
6...
7// Additional Code

Tip: 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

Key Takeaways

  • The commitLine method efficiently handles sublist line data in client scripts.
  • Proper parameters must be provided to avoid errors during execution.
  • The method returns the invoking currentRecord object, allowing further manipulations.

Frequently Asked Questions (4)

Do I need to enable any feature flags to use the currentRecord.commitLine method?
No, the currentRecord.commitLine method does not require any special feature flags to be enabled as it is part of the standard SuiteScript 2.x client scripts.
Can I use the commitLine method with any kind of sublist in a client script?
You must ensure the sublist specified is editable and the sublistId provided is correct; otherwise, errors such as SSS_INVALID_SUBLIST_OPERATION may occur.
What happens if I set ignoreRecalc to true when using the commitLine method?
Setting ignoreRecalc to true means that any subsequent recalculations triggered by scripts will be ignored, which might be useful if you want to prevent specific events or calculations from running after committing a line.
What errors should I handle when using the commitLine method in my script?
You should handle SSS_INVALID_SUBLIST_OPERATION if the sublist is not editable or the sublistId is incorrect, and SSS_MISSING_REQD_ARGUMENT if any required parameter is missing or undefined.
Source: Errors 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 Platform

View all Platform articles →