What is the purpose and use of global check box in client script

RenikuntlaSai
Tera Contributor

Hi Team,

 Could you please help me with the below query. Thanks in advance.

What is the purpose and use of global check box in client script?

3 REPLIES 3

Appanna M
Tera Guru

Hello @RenikuntlaSai ,

 

The "global" checkbox in a client script in ServiceNow serves as a way to control the visibility and accessibility of the script across different scopes within the application. Here's how it works and how it's typically used:

Scope Control:

When you create or edit a client script in ServiceNow, you have the option to mark it as "global" by checking the corresponding checkbox. If the "global" checkbox is checked, the client script is accessible from any scope within the application, including global, application, and table-level scopes.

If the "global" checkbox is unchecked, the client script is limited to the scope in which it was created or defined.

 

Please Mark My Answer as Helpful and Accept as Solution, if you find this article helpful or resolves your issue.

Maddysunil
Kilo Sage

@RenikuntlaSai 

Purpose:

The global checkbox in a client script provides a means to control the execution of the script across all records or forms within a particular scope. When this checkbox is selected, it signifies that the script should execute its logic for every applicable record or form. Conversely, when it's not selected, the script will only execute under specific conditions or for individual records as determined by the script logic.

Use Cases:

  1. Mass Updates: If you have a client script that needs to perform a certain action on multiple records at once, you can use the global checkbox to ensure that the script runs for all records when triggered.

  2. Field Validations: Sometimes, you might need to enforce a validation rule across all records or forms. Enabling the global checkbox ensures that the validation logic applies universally.

  3. User Interface Customizations: When customizing the user interface behavior, such as hiding or showing certain fields, you may want these changes to be applied consistently across all forms. The global checkbox helps in achieving this consistency.

  4. Data Formatting: If you need to format data consistently across all records or forms, the global checkbox ensures that your formatting script runs universally.

  

Please Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks