---
sourceDocument: Brazil API Reference
sourceDocumentLink: https://www.servicenow.com/docs/r/api-reference

 Release :

    - brazil

ft:locale :

    - en-US

ft:publication_title :

    - Brazil API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# Write client-side scripts

# Writing client-side scripts {#ariaid-title1}

Release version: Brazil  
Updated September 10, 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read  
Write scripts that run JavaScript on the client (web browser) when client-based events occur, such as when a form loads, after form submission, or when a field changes value.

## Client-side API reference {#client-side-scripting-overview__cf-using-more-info}

When writing client-side scripts, you use client-side JavaScript APIs to control aspects of how ServiceNow AI Platform is displayed and functions within the web browser. For information about available client-side APIs, see the [Client API reference](https://www.servicenow.com/docs/MfK8Ri0DpC4LXR_6fQRS~A "Use client-side JavaScript APIs to control aspects of how ServiceNow AI Platform is displayed and functions within the web browser. This reference lists available classes and methods along with parameters, descriptions, and examples to help control the end-user experience.").
* **[Client scripts](https://www.servicenow.com/docs/m~qpjf1kCdF4XYAp1fLLLA#client-scripts)**   
  Client scripts allow the system to run JavaScript on the client (web browser) when client-based events occur, such as when a form loads, after form submission, or when a field changes value.
* **[UI scripts](https://www.servicenow.com/docs/FW0aWA3LoEoa0ah6rTxPaQ#c_UIScripts)**   
  UI scripts provide a way to package client-side JavaScript into a reusable form, similar to how script includes store server-side JavaScript. Administrators can create UI scripts and run them from client scripts and other client-side script objects and from HTML code.
* **[UI pages and macros](https://www.servicenow.com/docs/nH9qFFjn5ZDdv9N~0Kpg8A)**   
  Use UI pages to create custom pages for an application and UI macros for custom controls or interfaces.
* **[AJAX scripts](https://www.servicenow.com/docs/h1cWBrEDdpRzWDHeK~DszA#p_AJAX)**   
  AJAX (asynchronous JavaScript and XML) is a group of interrelated, client-side development techniques used to create asynchronous Web applications.
* **[Display field messages](https://www.servicenow.com/docs/BHRJGhxbQ1dJG~kn9hYVxw)**   
  Rather than use JavaScript alert(), for a cleaner look, you can display an error on the form itself. The methods showFieldMsg() and hideFieldMsg() can be used to display a message just below the field itself.
* **[General guidelines for client script design and processing](https://www.servicenow.com/docs/NqD6KiDz69qiyeN89CCjQw#client-script-best-practices)**   
  Well-designed client scripts can reduce the amount of time it takes users to complete a form.
* **[Client-side scripting for mobile](https://www.servicenow.com/docs/nPCpbMFTwePgHErancv38w)**   
  Client scripting for mobile is identical to scripting for the web, with some exceptions. All new scripts must conform to certain guidelines. The following items are affected on the mobile platform: client scripts, UI policies, navigator modules, and UI actions.

**Related concepts**   

* [Client API reference](https://www.servicenow.com/docs/MfK8Ri0DpC4LXR_6fQRS~A "Use client-side JavaScript APIs to control aspects of how ServiceNow AI Platform is displayed and functions within the web browser. This reference lists available classes and methods along with parameters, descriptions, and examples to help control the end-user experience.")

