Discussions
New to NetSuite | Client Script: sublistChanged(scriptContext)
After discussing all the types of SuiteScript in the New to NetSuite | SuiteScript Types Overview article, we are now focusing on the different types of Client Script. The sublistChanged function is triggered whenever a user interacts with a sublist on a record. It is particularly useful for responding to changes in a sublist, such as updating values dynamically, validating inputs, or triggering calculations. This includes actions like:
- Adding a new line to a sublist
- Editing an existing line
- Removing a line from the sublist
Here's a simple example of a sublistChanged function:
/**
* @NApiVersion 2.x
* @NScriptType ClientScript
* @NModuleScope SameAccount
*/
define(['N/error','N/currentRecord'],
function(error,currentRecord) {
/**
* Function to be executed after page is initialized.
*
* @param {Object} scriptContext
* @param {Record} scriptContext.currentRecord - Current form record
* @param {string} scriptContext.mode - The mode in which the record is being accessed (create, copy, or edit)
*
*
*/
/**
Richard James Uri - SuiteCloud | WMS Tech | SuiteCommerce Advanced
----
- NetSuite Admin Corner | New to NetSuite
- Explore the NSC Webinars Category
- Join our poll and share your ideas! We want to know what you think. Don't forget to comment and make your voice heard!
