NetSuite script parameters: Company, User and deployment scopes

Configure Company, User and deployment script parameter values in NetSuite, then compare raw values, Boolean types and null results in two read-only Suitelets.

The quick answer

For these parameter types, the Preference setting determines where the value is configured. Company values are set at Setup > Company > General Preferences > Custom Preferences. User values are set at Home > Set Preferences > Custom Preferences. In this example, a blank-Preference note is configured on the Source script deployment’s Parameters subtab. Compare the runtime value and JavaScript type before treating an unchecked or empty control as a missing value.

This walkthrough compares two prepared, read-only SuiteScript 2.1 Suitelets. Source declares three parameters; Reader declares none. Both use the same fixed parameter ID reads through N/runtime and return diagnostic text responses. The comparison uses the same signed-in user, role and Suitelet execution context throughout.

Person and company names, and user and script record IDs, are fictional example data.

Before you start

Prepare two Suitelets named Parameter Scope Source and Parameter Scope Reader, with identical diagnostic code. The code reads each raw value with getParameter, records its JavaScript type, and distinguishes null, undefined, empty strings and a value property present in the serialized JSON. These flags come from the diagnostic JavaScript.

On Source, prepare these three definitions:

  • Sample User Flag: custscript_scope_user, Check Box, Preference User.
  • Sample Company Form: custscript_scope_form, List/Record Transaction Form, Preference Company.
  • Sample Deployment Note: custscript_scope_note, Free-Form Text, Preference blank.

Leave Reader’s Parameters table empty. Prepare an internal deployment for each script. The demonstrated deployments have Deployed checked, Testing status and Current Role selected, with Available Without Login unchecked. Both are accessed by the script owner; this does not establish access for other users or roles. Verify that your intended signed-in user can open both internal URLs; this example does not establish who else can access them.

Use a role that can inspect the definitions and change the relevant preferences and deployment values. The example uses Administrator. Keep the same executing user and role configuration for all four responses. The diagnostic writes HTTP responses without creating business records.

01. Inspect the prepared definitions

Open Source’s Parameters subtab. Match each field’s ID and type to its Preference value. The two shared preference fields and the deployment note use different configuration locations.

The Preference values are User, Company and blank, in that order. Enlarge to match each row to its description, ID and type.

Open Reader’s Parameters subtab. Its table has no definitions, while its prepared code still reads the same three IDs.

Reader declares no parameters. Enlarge to confirm its script name and selected Parameters subtab.

The response comparison below records what these scripts return in this user, role and execution context. It does not establish undeclared-parameter behavior for every script or account.

02. Configure the first set of values

At Setup > Company > General Preferences, open Custom Preferences. Under General, select Standard Sales Order for Sample Company Form, then save.

The Company preference displays Standard Sales Order. Its raw runtime value is checked separately.

At Home > Set Preferences > Custom Preferences, leave General > Sample User Flag unchecked and save.

The first comparison uses an unchecked Sample User Flag for the signed-in user.

Open the prepared Source deployment, choose Edit, and open Parameters. Enter Initial review in Sample Deployment Note, then save. Leave the corresponding User and Company controls on this deployment untouched; their preference values are configured on the separate pages above.

Initial review is configured on Source’s deployment Parameters subtab.

03. Compare the first Source and Reader responses

While signed in as the demonstrated script owner, open each deployment’s internal URL. Confirm that both responses report the same runtime user, role and SUITELET execution context. Inspect values and types together:

  • Source returns Boolean false, string "68" and string "Initial review".
  • Reader returns Boolean false, string "68" and null.

The displayed Standard Sales Order resolves to string "68" in this example. Treat that as the observed form value for this account, rather than a universal ID.

Reader’s note is present as null. Enlarge to inspect User false, Company string 68 and the matching runtime context.

Reader’s note reports isNull: true, isUndefined: false and hasValueProperty: true. Its jsType is "object", because JavaScript’s typeof null returns "object". The null value is present in the JSON; it was not dropped during serialization. Boolean false is also a value to preserve.

04. Change the current user flag and Source note

Return to Set Preferences > Custom Preferences, check Sample User Flag, and save. This is the same signed-in user as the first comparison.

The second comparison changes this same user’s flag to checked.

Edit Source’s deployment note to Follow-up review and save. Leave the Company preference and Reader deployment unchanged. Open both internal URLs again.

Source now returns Follow-up review for its note. Enlarge to inspect User true and the unchanged Company form value.

Both responses now return Boolean true for the User flag and the same string "68" for the Company form. Source returns string Follow-up review; Reader still returns null for the note.

Reader’s note remains null in the second comparison. Enlarge to inspect User true, Company string 68 and the same execution context.

Confirm that the runtime user, role and execution context match the first pair. The observed User change appears in both tested responses, the Company form stays unchanged, and the note changes only in Source’s response. An explicit null result here is a completed response, rather than evidence that the Suitelet failed.

Common questions

Where do I configure Company and User script parameters?

Inspect the parameter’s Preference setting first. Company values are configured under General Preferences > Custom Preferences. User values are configured under Set Preferences > Custom Preferences for the signed-in user. In this example, the blank-Preference note is configured on Source’s deployment Parameters subtab.

Why can the response return true when the deployment’s checkbox is unchecked?

Check whether the parameter uses User preference scope. This walkthrough leaves the Source deployment’s User and Company controls untouched and configures those values on their preference pages. The second response resolves the same user’s checked preference. The example does not test deployment overrides.

Can every script read a Company or User parameter it has not declared?

This same-user, same-role Suitelet comparison shows Reader resolving the configured User and Company values by their IDs while its Parameters table is empty. Treat that as the tested result. Verify the behavior you need in your own script, role and execution context before relying on it elsewhere.

Does a null value with type object indicate a NetSuite object?

No. JavaScript’s typeof operator returns object for null. In the shown Reader response, isNull is true, isUndefined is false, and the value property is present with an explicit null value. The diagnostic flags describe the JavaScript result.

Should I treat false, null and an empty string as equivalent?

Keep them separate when debugging. The User checkbox returns Boolean false in the first comparison; Reader’s note returns null. The diagnostic also checks undefined, empty strings and whether serialization retained the value property, so these cases can be identified separately.

Does a User preference enforce permission to perform an operation?

A preference configures a value. Operations that require authorization still need their appropriate role and permission checks. The runtime user and role fields in this response describe the tested execution; they do not prove an authorization boundary.

Sources

Oracle documents script parameter preferences and getParameter return types.