SuiteScript 2.x Client Script Reference
Refer to the following guidance to help you write client scripts:
-
You can use the currentRecord module to access the active record in your client script. For more information, see Using the currentRecord Module in Client Scripts.
-
You can specify that your client script only runs for certain roles. For more information, see Client Script Role Restrictions.
-
You can use the N/log module in a client script like you would in a server script, but if it's attached to a form (see SuiteScript 2.x Form-Level Script Deployments), log functions (log.audit, log.debug, log.emergency, log.error) won't work, and they'll be ignored. The script will run fine, but nothing gets logged. For logging in a client script attached to a form, use console.log instead.
-
Client scripts interact with remote objects when they access the NetSuite database to create, load, copy, or change records. For more information, see Interfacing with Remote Objects in Client Scripts
-
When you run a search in a client script, it uses the user's current role, which can cause issues if that role can't view 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.