ServiceNow Client Script Best Practices: onLoad, onChange, onSubmit
ServiceNow client script best practices for onLoad, onChange and onSubmit: when to use each type, how to avoid slow forms, and safe GlideAjax patterns.
Read guidePractical guides, useful scripts, and lessons from working with the platform. A little less figuring it out. A little more getting it done.
A targeted query is a good place to start.
// Only the records you need
var incidents = new GlideRecord('incident');
incidents.addQuery('active', true);
incidents.setLimit(10);
incidents.query();Read the query performance guide 
The notebook
ServiceNow client script best practices for onLoad, onChange and onSubmit: when to use each type, how to avoid slow forms, and safe GlideAjax patterns.
Read guideA worked Scripted REST API example in ServiceNow: create the API, add GET and POST resources, read parameters, return errors, secure it, and test with curl.
Read guideHow sysparm_view, sysparm_query, sys_id=-1 and other ServiceNow URL parameters work, with examples for forms, lists, modules and the REST Table API.
Read guideThe script library
75 ServiceNow examples across client scripts, business rules, integrations, and more. Find a pattern, understand it, and adapt it to your instance.
Open the script libraryHave a ServiceNow question or a project in mind?