SuiteScript 2.x Client Script Reference
Refer to the following guidance to help you write client scripts:
-
In a client script, you can access the record that is active in the current client context using the currentRecord module. For more information, see Using the currentRecord Module in Client Scripts.
-
You can specify that your client script only executes for certain roles. For more information, see Client Script Role Restrictions.
-
You can use the N/log module in a client script the same as using the module in a server script, however, if the client script is attached to a form (see SuiteScript 2.x Form-Level Script Deployments), calls to any log function (log.audit, log.debug, log.emergency, log.error) are ignored. The script executes successfully, however, nothing will be logged. To log messages in a client script that is attached to a form, use the console.log function.
-
Client scripts interface with remote objects anytime they call the NetSuite database to create, load, copy, or transform an object record. For more information, see Interfacing with Remote Objects in Client Scripts
-
When running a search on client scripts, the permission level is always set to the user's currently logged in role, which may cause problems if the role doesn't have view permissions to the record. For information about how this restriction can be bypassed, see Unrestricted Search Permissions in Client Scripts.
Also see the Client Script Best Practices section in the SuiteScript Developer Guide for a list of best practices to follow when using client scripts.