How and when to write client-side scripts

Client-side scripts should be written when a developer wants to change the screen in front of the user. This could be a change to a field value, visibility, or another change. Every time client-side scripts are run, it requires resources from the instance, and so keeping client-side scripting to a minimum is important.

If you can make a change on the server side rather than the client side, then is it considered best practice to do so. This will then keep loading times shorter and improve the user experience.

Let's have a look at some common uses for client-side scripting and how best to achieve these tasks.

Get Mastering ServiceNow Scripting now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.