unlocking the potential of servicenow ui pages: top use cases and solutions
Working with UI pages often involves searching for the appropriate code or syntax—a common challenge even for experienced developers. This is mainly because Jelly script syntax/logic is not something we work with regularly, making it harder to recall.
This blog aims to provide helpful code snippets and logic for common use cases related to UI pages.
How to access parameter from UI Action to UI Page?
Example: pass parameter from UI action as shown below:
Method 1: Access parameter in html code.
We can attach value to html tag directly by using below syntax:value="${sysparm_number}Access parameter in UI Page HTML Code as shown below:

Method 2: Access parameter in UI Page client script.
Access parameter in UI Page Client Script Code as shown below:
Note: remember to always use variable name starting with sysparm_xxxxx
How to stop UI Page submission
There are many situations where we need to validate user entered details and stop form submission if data is incomplete or incorrect. We can use below mentioned script logic to do so:
HTML Script: In this section, we will utilize the "dialog_buttons_ok_cancel" tag to include both "OK" and "Cancel" buttons. Upon selecting "OK," the form will validate whether a "Resolution Code" has been selected and will submit the form accordingly.
Client Script: Upon successful validation, we will utilize "return true" or "return false" to manage the form submission process. If validation is successful, the UI page can be closed using "GlideModal.get().destroy();" and the incident form information will be saved using the g_form object, as demonstrated below.

Note: The processing script will only execute when your client script returns true. In such cases, avoid using the destroy method to close the UI page. Instead, you can include code in the processing script to redirect to a specific page.
How to access variables from UI Page HTML code to client Script/Processing Script
We will try accessing below defined Resolution Notes value:
<textarea id="resolutionNotes" name="resolutionNotes" />
1. Client Script: as this is generic javscript, we can use either of below codedocument.getElementById("resolutionNotes").value; OR gel("resolutionNotes").value
2. Processing script: we can directly use tag name as variable to access its value
var resNotes=resolutionNotes; //Name of textareas tag
Download Files
Download Update Set with UI Page and UI ActionDownload UI Page
Comments
🚀 Power Up Your ServiceNow Career
Join a growing community of smart ServiceNow professionals to stay ahead in interviews, sharpen your development skills, and accelerate your career.