What This Table Is

The sys_script_client table contains Client Scripts that execute in the user's browser to control form behavior. Unlike server-side Business Rules, these scripts run immediately as users interact with forms—validating data, hiding fields, making fields mandatory, or triggering alerts. Client Scripts are the primary mechanism for creating dynamic, responsive forms in ServiceNow.

Owned by the Development module, Client Scripts support four event types: onLoad (form initialization), onChange (field value changes), onSubmit (form submission), and onCellEdit (list editing). They work across regular forms, Service Catalog items, and mobile interfaces, though with important behavioral differences.

Client Scripts don't extend other tables—they're standalone records that apply to specific tables via the table field. Unlike Business Rules that can cascade through table inheritance, Client Scripts must be explicitly created for each table where you need them. Global Client Scripts (where global is true) run on all tables but have limited API access.

Large enterprises typically have 200-500 active Client Scripts. Performance matters because these scripts affect user experience directly—slow Client Scripts create laggy forms. The platform loads all applicable Client Scripts when a form opens, so excessive script count impacts page load times.

When You'll Script Against This Table

You'll query sys_script_client primarily in Script Includes and Business Rules when building administrative tools, custom form builders, or migration utilities. Server-side scripts commonly query this table to discover what Client Scripts exist, clone configurations between instances, or programmatically manage form behavior. Scheduled Jobs also use this table when auditing client-side customizations or generating documentation.

Access requires the admin role by default. The script field containing the JavaScript code has additional ACL restrictions—developers need explicit sys_script_client.script access to read or modify the actual code.

  • Clone Client Scripts between development, test, and production instances
  • Build admin utilities that bulk-disable Client Scripts for troubleshooting
  • Generate documentation showing which tables have client-side validation
  • Audit scripts for security issues like direct DOM manipulation or hardcoded values
  • Create custom form builders that generate Client Scripts programmatically
  • Find unused or duplicate scripts during platform cleanup efforts
  • Migrate table-specific scripts when consolidating or splitting table structures

Table Gotchas

⚠️

The ui_type field controls where scripts run: 0=Desktop, 10=Mobile, 0=Both. Setting this wrong means your script won't execute on mobile devices, which breaks mobile workflows.

⚠️

Global Client Scripts (global=true) can't access g_form.getReference() or other advanced APIs. They only get basic g_form methods, which trips up developers who copy code from table-specific scripts.

  • The condition field uses server-side syntax but runs before the script loads. Complex conditions can slow form loading because they're evaluated server-side first.
  • Client Scripts on Service Portal forms behave differently—some g_form methods aren't available, and the execution timing differs from regular forms.
⚠️

The applies_to field (not visible in lists) stores internal table inheritance data. Don't modify this directly—it's automatically maintained by the platform when you set the table field.

  • Order field values matter for onChange scripts targeting the same field. Lower numbers run first, but relying on execution order creates fragile code.
  • Scripts with active=false still appear in Studio and can be accidentally reactivated. Always check the condition to understand why a script was disabled.
Free Newsletter

Enjoying this? Get one deep-dive per week.

Join 1,000+ ServiceNow pros — scripts, GlideRecord patterns, Flow Designer techniques, and career moves. Free.

No spam · Unsubscribe anytime

The sys_db_object table defines which tables exist and is referenced by the table field. When building administrative tools, you'll join these tables to show human-readable table names instead of internal names. The sys_dictionary table is essential for onChange scripts—you need it to validate that the target field actually exists on the specified table.

The sys_script (Business Rules) and sys_ui_policy (UI Policies) tables work alongside Client Scripts to control form behavior. Developers often query all three together when analyzing how a form behaves—UI Policies for declarative field control, Client Scripts for custom JavaScript logic, and Business Rules for server-side validation. The sys_update_xml table tracks Client Script changes through Update Sets, making it crucial for deployment and rollback scenarios.