- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
7 hours ago
Supercharge Your Mobile Forms in ServiceNow with Client Scripting
If you’ve ever filled out long, repetitive mobile forms in ServiceNow, you know how frustrating it can be. Wouldn’t it be great if your forms were smart enough to auto-fill values, validate themselves, and even fetch data from the platform as you go?
That’s exactly what mobile client scripting enables—and in this Platform Academy session, Tal and Sana walk us through everything you need to know to get started.
Why Mobile Client Scripting?
Before the Xanadu release, mobile input forms lacked dynamic behaviors. Selecting a value in one field had no effect on others. With long forms, this meant lots of manual work. Enter mobile client scripting, which lets you:
- Auto-fill input fields based on user selections
- Show error or info messages before submission
- Use Mobile Callable Script Includes to dynamically pull data from the platform
Meet the MForm API
If you know g_form from web development, you’ll love MForm. It gives you methods like getValue, setValue, addInfoMessage, and more. It’s your toolkit for dynamic field behavior in mobile apps.
Dynamic Data with Script Includes
Need to pull related data—like the manager of an assignment group? That’s where Mobile Callable Script Includes come in. You can call these from your client scripts using the MobileScriptIncludeCaller API. Just make sure:
- The script include is marked as Mobile Callable
- It extends AbstractMobileCallableInclude
- It returns values efficiently
Real-World Use Case: Auto-Assigning an Incident
In the demo, Tal walks us through an example where the "Assigned To" field is automatically populated based on the selected assignment group’s manager. Starting with a simple hardcoded script, they then enhance it by calling a script include that dynamically fetches the manager.
They even add error messages if no manager is found, and use a shimmer effect to let users know a script is running.
Pro Tips and Gotchas
- Mobile client scripting only supports the "onChange" trigger
- One client script per UI Rule
- Don’t modify the default function signature
- Always check for typos if things don’t work
- Scripts must be efficient—especially on mobile
Wrap-Up
This session is packed with practical knowledge that any ServiceNow developer can apply right away. Whether you're building internal tools or customer-facing mobile apps, learning to leverage client scripting will elevate your user experience—and save time.
Catch the full video above and start building smarter forms today!