ANS-1714 · SUITESCRIPT DEVELOPMENT

How Do Scripted Buttons Function in NetSuite Forms?

Custom button actions on NetSuite forms are client-side, affecting logging and file operations.

Short answer

Custom button actions on NetSuite forms are client-side. Client scripts can use `console.log` for debugging, and `N/log` works if the script is linked via `clientScriptModulePath`. However, direct file loads via `N/file.load()` are not supported, as this method is exclusive to server-side scripts.

Scenario

Users often implement custom buttons on NetSuite forms to trigger specific actions. It is crucial to understand the execution context of these buttons to correctly implement logging and file operations.

Solution

When a custom button is added to a NetSuite form, all actions performed by that button are executed as client-side scripts.

Client-side scripts can utilize console.log for debugging purposes. Furthermore, the N/log module can be employed, with logs appearing in the parent server script's deployment log if the client script is associated with a form via clientScriptModulePath.

Direct file loads using N/file.load() are not supported from client-side scripts, as this method is designed for server-side execution.

Expert NetSuite Support

Need help with this NetSuite issue?

SuiteScript Development consulting and configuration support

Talk to a consultant