ANS-0562 · SUITESCRIPT DEVELOPMENT
Why Client Scripts on Suitelets Don’t Inherit ‘Execute as Admin’ Rights
Understand why client-side scripts attached to Suitelets operate under the user's permissions, regardless of server-side script settings.
Short answer
Client scripts attached to Suitelets, even when configured with 'Execute as Admin' on the server-side script record, will not inherit these elevated permissions. Client scripts execute in the user's browser environment, adhering strictly to the user's assigned roles and permissions, ensuring security and data integrity within NetSuite.
Scenario
When developing Suitelets in NetSuite, developers often attach client scripts to enhance user interaction and form functionality. A common expectation is that if the server-side Suitelet script is configured to 'Execute as Admin', any attached client script would also inherit these elevated permissions. However, this configuration does not extend administrative rights to the client-side script, leading to unexpected permission errors or restricted functionality for users.
Solution
Client scripts, regardless of how they are attached to a Suitelet form, execute within the user's browser environment. This means they operate strictly under the permissions of the currently logged-in user, not the 'Execute as Admin' setting of the server-side Suitelet script.Even when a Suitelet is configured to run with administrative privileges, and a client script is attached using modern SuiteScript 2.x methods such as Form.clientScriptModulePath or Form.clientScriptFileId, the client script will not inherit these elevated rights.This behavior is by design to maintain security and ensure that client-side operations are always constrained by the user's assigned roles and permissions. Developers should design client scripts to function within the user's standard permissions or utilize server-side Suitelet functions (which *do* execute as admin if configured) to perform operations requiring elevated privileges.
Expert NetSuite Support
Need help with this NetSuite issue?
SuiteScript Development consulting and configuration support
