---
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


---

# Client-side scripting for mobile

# Client-side scripting for mobile {#ariaid-title1}

Release version: Brazil  
Updated September 10, 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 3 minutes to read
Summarize  
![AI sparkle icon](https://servicenow.com/docs/portal-asset/ai-sparkle-icon) Summarized using AI  
This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.  

## Summary of Client-side scripting for mobile

Client-side scripting for mobile in ServiceNow closely mirrors web scripting but requires adherence to specific guidelines to ensure compatibility with the mobile platform.
This affects client scripts, UI policies, navigator modules, and UI actions.
Scripts must be enabled and adapted specifically for mobile to function properly.
Show full answer Show less  

## Key Guidelines for Mobile Client Scripting

* **Enable scripts for mobile:** All client scripts must be explicitly enabled for the mobile UI.
* **Use new mobile methods:** Replace deprecated methods like `gform.getControl()` with new Mobile GlideForm API methods designed for mobile-friendly form field manipulation.
* **Avoid deprecated methods:** Methods such as `gform.getControl()`, `gform.getFormElement()`, and `gform.getElement()` are no longer supported on mobile and must be removed or replaced.
* **Do not reference unsupported browser objects:** Objects like `window`, `document`, and libraries such as jQuery or Prototype are unsupported. Use `gform` methods like `setLabel()` and `hasField() instead.`
* **Eliminate synchronous calls:** Synchronous JavaScript, GlideAjax, and GlideRecord calls are disallowed. For instance, `gform.getReference()` and GlideRecord queries must include callback functions for asynchronous operation.
* **Avoid methods unavailable on mobile:** Some methods such as `showRelatedList()`, `hideRelatedList()`, `flash()`, and `enableAttachments()` do not function on mobile and should not be used.

## UI Policies, Navigator Modules, and UI Actions

* **UI Policies:** The "Run scripts in UI type" field controls whether scripts run on mobile, desktop, or both. Existing and new policies should be configured to apply appropriately.
* **Navigator Modules:** Modules must reside in the `sysuiapplication` or `sysuimodule` tables to be accessible on mobile.
* **UI Actions:** UI actions must be created or transferred to the `sysuingaction` table for mobile availability. Scripts that avoid deprecated methods generally do not require changes.

## Practical Impact for ServiceNow Customers

By following these guidelines, customers can ensure their client-side scripts and UI customizations work seamlessly on the ServiceNow mobile platform. This leads to consistent user experiences across devices, avoids runtime errors, and leverages the supported mobile API for robust mobile application behavior.  
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.

## General guidelines for writing client-side scripts for mobile

For new or existing scripts to be valid for mobile, they must conform to the following requirements:

* Enable scripts to run on the mobile UI.
* Use the new mobile methods in place of g_form.getControl().
* Don't use deprecated methods.
* Don't reference unsupported browser objects.
* Don't make synchronous JavaScript, GlideAjax, and GlideRecord calls.
* Don't call methods that aren't available for mobile.

For more information, see the following details.
{#r_MobilePlatformMigrationImpacts__table_Requirements__entry__2}

| Guideline | Details |
|-|-|
| Enable scripts for mobile | Scripts must be enabled for the mobile platform. |
| Use the new mobile methods | Several new methods are available for modifying form fields instead of directly manipulating the HTML. These methods replace previous usages of g_form.getControl(), which is deprecated for the mobile platform. In your existing scripts, ensure that the new methods are used in place of methods that aren't valid on the mobile platform. For information on these new methods, refer to [Mobile GlideForm() API](https://www.servicenow.com/docs/ZK3AQlYu~DPzdroXYKOnDQ#c_MobileGlideForm_API "The Mobile GlideForm (g_form) API provides methods to work with forms on the mobile platform."). |
| Don't use deprecated methods | The following methods have been deprecated for the mobile platform because direct access to HTML elements is not allowed: * g_form.getControl() * g_form.getFormElement() * g_form.getElement() To ensure that existing scripts are compatible, remove all calls to deprecated methods from your code. For new scripts, don't use deprecated methods if you want the script to be valid for mobile. For g_form.getControl(), some of the functionality previously included with this method has been extracted to individual methods. Instead of g_form.getControl(), use the new methods described on the developer site. |
| Don't reference unsupported browser objects | The following browser objects aren't supported in mobile scripts: * Window * jQuery or Prototype ($, $j, or $$) * Document Make sure that new scripts don't use these objects, and remove any usage of these objects from your existing scripts. Use GlideForm (g_form) instead, which provides methods such as setLabel(), addDecoration(), and hasField() for accomplishing the same tasks. |
| Don't make synchronous JavaScript calls | The mobile platform does not allow synchronous JavaScript calls. The g_form.getReference() method must now have the callback parameter defined. For example: g_form.getReference(fieldName, callback) Be sure that all g_form.getReference() calls include the callback parameter. For example, the following script does not include a callback and is incompatible with the mobile platform: var userName = g_form.getReference('assigned_to').user_name; g_form.setValue('u_assigned_user_name', userName); The following script has been updated to include the callback and is compatible with the mobile platform: g_form.getReference('assigned_to', function(now_GR) { g_form.setValue('u_assigned_user_name', gr.user_name); }); |
| Don't make synchronous Ajax calls | The mobile platform does not allow synchronous GlideAjax calls. Any use of getXMLWait() in a GlideAjax call will not work on the mobile platform. Be sure that all GlideAjax calls are asynchronous. For more on synchronous versus asynchronous GlideAjax calls and getXMLWait(), see [AJAX](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."). For information on the available GlideAjax methods, refer to the [GlideAjax API](https://www.servicenow.com/docs/JJl75kuc3uBDrna~64UK2A#c_GlideAjaxAPI "The GlideAjax class enables a client script to call server-side code in a script include."). |
| Don't make synchronous GlideRecord calls | The mobile platform does not allow synchronous [GlideRecord](https://www.servicenow.com/docs/FgjTlm40d6FI5VbkwXi4qQ#c_GlideRecordScopedAPI "The scoped GlideRecord API is used for database operations.") calls. Make sure that any existing GlideRecord calls include a callback. For example, the following script does not include a callback and is incompatible with the mobile platform: var now_GR = new GlideRecord('incident'); gr.addQuery('number', g_form.getValue('related_incident')); gr.query(); gr.next(); g_form.setValue('u_related_incident_description', gr.short_description); The following script has been updated to include the callback, and is compatible with the mobile platform: var now_GR = new GlideRecord('incident'); gr.addQuery('number', g_form.getValue('related_incident')); gr.query(function(now_GR) { gr.next(); g_form.setValue('u_related_incident_description', gr.short_description); }); |
| Don't use methods unavailable on the mobile platform | Due to the limitations and reduced functionality that is imposed by the mobile platform, the following methods aren't deprecated but aren't available on the mobile platform. If these run on the mobile platform, no action occurs: * showRelatedList () * hideRelatedList () * showRelatedLists () * hideRelatedLists() * flash() * getSections() * enableAttachments() * disableAttachments() * setReadonly() (Note that setReadOnly() is available) * getParameter() |
[Table 1. Guidelines for client-side scripting for mobile]

{#r_MobilePlatformMigrationImpacts__table_Requirements}  
Note:  
Focusing an element on a mobile form is not supported.

## UI policies {#r_MobilePlatformMigrationImpacts__UIPolicies}

Use the Run scripts in UI type field to determine whether scripts
run on the mobile platform, the desktop, or both. Update existing policies so that they
apply to either the mobile platform or both. For new scripts, also ensure that the mobile
option or both is selected.

## Navigator modules

For existing code, modules must be transferred to either the sys_ui_application or
sys_ui_module tables to be available on the mobile platform. When developing new code, be
sure that all modules are created in the sys_ui_application or sys_ui_module tables.

## UI actions

UI actions must be transferred to the sys_ui_ng_action table to appear on the mobile platform. UI action scripts that don't use deprecated methods don't require changes to the script itself. For new UI actions, be sure that they
are created in the sys_ui_ng_action table.

