Creating Script Parameters Overview
In the context of SuiteScript, script parameters are similar to custom fields; they are not considered to be parameters that are passed between JavaScript functions. Script parameters share characteristics with custom fields created through point-and-click customization. Script parameters are configurable by administrators and the users of your Suite App, and are accessible programmatically through SuiteScript. Script parameters are defined on the Parameters tab of the Script record page.
Do not include confidential information in script parameters. Information saved in script parameters can be indexed by search engines and therefore be viewable by the public. This means, for example, that the information could be found in Google searches.
You should create script parameters in the following situations:
-
You want part of your script to be configurable, either through script deployment or by the users of your SuiteApp. You do not need to create script parameters if your script is not designed to be configurable.
-
You need to parameterize a script that was deployed multiple times. This approach makes it more convenient to customize the behavior of the script for each deployment.
-
You want to configure a scheduled script. You're able to do this by specifying configuration parameters as arguments to task.create(options).
The advantages of using script parameters include:
-
With deployment-specific parameters, you can configure script behavior without writing code. These parameters are useful when administrators deploy scripts that were installed as part of a bundle. The parameters let administrators to control or modify the script without knowing anything about the code. Deployment-specific parameters are similar to property or configuration files that some applications use to modify behavior at runtime.
-
Script parameters let you to modify script behavior for troubleshooting without changing code, which is often expensive and not feasible (for example, if the original script author is unavailable).
-
Script parameters provide flexibility to handle various inputs based on context. For example, consider a situation in which one script is deployed to 50 different records, but requires slightly different behavior for each record. You could hard-code and deploy 50 different scripts, but they may be difficult to maintain because the code isn't configurable, code might be duplicated unnecessarily, and changes in business requirements likely require code changes.
For more information, see the following help topics: