ANS-0309 · SUITESCRIPT DEVELOPMENT

How to Trigger a Native Save Button with Custom Client-Side Scripting in NetSuite

This guide outlines a client-side scripting workaround to programmatically activate NetSuite's native save functionality from a custom button.

Short answer

To programmatically trigger NetSuite's native save button from a custom client-side script, an unofficial workaround involves using the 'getNLMultiButtonByName' function with the 'multibutton_submitter' identifier. This method simulates a click on the standard save button, allowing custom logic to precede the record submission process, though it relies on undocumented NetSuite internal functions.

Scenario

NetSuite users often require custom buttons on record forms to initiate specific actions. When these custom actions need to culminate in the standard record save process, directly triggering the native 'Save' button becomes necessary. This scenario typically arises when custom validations or pre-processing steps must occur before the record is officially committed.

Solution

While the officially supported method for custom button creation and action handling in NetSuite SuiteScript 2.x involves using the 'N/ui/serverWidget' module and defining functions within client scripts, a known workaround exists for directly triggering the native save button from client-side code. This approach utilizes an undocumented internal function to simulate a click on the standard 'Save' button. To implement this workaround, include the following client-side JavaScript snippet within your script:

javascriptgetNLMultiButtonByName('multibutton_submitter').onMainButtonClick(this);

This code snippet targets the native save button, identified by 'multibutton_submitter', and executes its primary click event. It is important to note that this method relies on undocumented NetSuite internal functions and may not be supported in future NetSuite releases. For officially supported custom button functionality, refer to NetSuite's SuiteScript 2.x documentation on 'N/ui/serverWidget'.

Expert NetSuite Support

Need help with this NetSuite issue?

SuiteScript Development consulting and configuration support

Talk to a consultant