
Hi there,
As I continue working on the HRSD implementation for a global company, I come across different problems. I enjoy the process of solving problems and now, with the help of AI, the process is even more interesting. I can ask it questions about anything, no matter how stupid :) I don't think that a human colleague would have the time and the patience to anwer all those questions :) That's probably the new way of learning nowadays.
I thought about compiling this list after looking for solutins and implementing a couple of them. Such as:
- Client script reading URL parameters, to populate fields on load
- UI Messages (getMessage), for translated text in client scripts
- Advanced reference qualifier, to filter which records a reference field offers
- Event parms, to send a notification to a recipient a Flow Action looked up — in my case a manager’s email, passed as parm1 to Fire Event
- Helper variables — hidden variables set by a client script, so a UI Policy can act on a value it cannot evaluate itself
- javascript: default values, set at the variable or dictionary level
The list is compiled with the help of AI and it goes beyond the familiar approach of passing values in the URL and reading them with a client script.
Each entry was checked against ServiceNow documentation or Community posts.
The Example column is illustrative. Field, variable, page and event names are placeholders.
One remark on the helper variables: hidden does not mean empty. The value still reaches the server on submit, so it can surface in the case description or the variables formatter.
I wrote about that gap, and how to work around it, here: https://victoriamunteanu.com/post/servicenow-hrsd-the-client-server-state-gap
Hopefully this will help someone, I'll use it as refence for future, nuttier, problems.
| # | Name | What it does | How to set it up | Example | Status |
|---|---|---|---|---|---|
| 1 | sys_id=-1&sysparm_query |
Opens a new record with fields pre-filled. |
Use Example: The docs also show |
Docs example: |
Verified |
| 2 | Client script reading URL parameters | Copies URL values into catalog variables. |
Write a catalog client script (onLoad) that parses Set the script's UI Type to All so it also runs on Employee Center. One user got a "document is null" error in a scoped app and fixed it by creating the script in global scope. |
|
Verified |
| 3 | sysparm_variable_values |
Native catalog prefill from the URL (Zurich and later). |
Add Reference variables need a sys_id. Catalog Client Scripts and UI Policies still run as if the user typed the values. Controlled by the property Not supported: attachment, custom, custom with label, masked, UI page, label/container, and multi-row variable sets (MRVS). |
Use your own portal URL prefix and variable names. |
Verified |
| 4 | variableValues property |
Prefill for Next Experience and Virtual Agent. |
Next Experience: All > Now Experience Framework > Experiences, select the UX app, Open in UI Builder, then add key-value pairs on the catalog item component property. Virtual Agent: open the "Request Catalog Item Inline" topic and enter a stringified JSON object in |
Virtual Agent
|
Verified |
| 5 | g_scratchpad |
Sends server data to client scripts at form load. |
Create a Business Rule with When = Display and set In any client script (onLoad, onChange, onSubmit) read Defined only in Display Business Rules; data is loaded once at form load. Use GlideAjax for dynamic lookups. |
Display Business Rule:
Client script:
Not confirmed for Workspace. |
Verified |
| 6 | putClientData / getClientData |
Passes session data from server to client. |
Server script: Client script: Docs suggest using it at form load to decide things like which fields to show. |
Server (e.g. Display Business Rule):
Client script:
|
Verified |
| 7 | g_user.setClientData() |
Stores a value on the client for later reads. |
Call The docs show an onSubmit script that caches a looked-up value this way. |
onChange:
onSubmit:
|
Verified |
| 8 | UI Page parameters (Jelly) | Takes URL parameters in a UI Page. |
Open the page as Another suggestion is Community answers are mixed: in one thread |
URL: Jelly:
|
Verified, with caveats |
| 9 | UI Messages (getMessage) |
Server-managed strings, cached on the client if preloaded. |
Create a record under System UI > Messages with a key, then call Also list the key in the client script's Messages field. This preloads it and avoids a server round trip. Without it,
|
Create the key
|
Verified |
| 10 | g_form.getReference() |
Reads a referenced record's fields without a Script Include. |
In a client script (often onChange): Always pass a callback so it runs asynchronously. It fetches the whole record, which can be slow. GlideAjax is better when only one or two fields are needed. |
|
Verified |
| 11 | Advanced reference qualifier | Filters a reference field's choices using other values. |
Set the qualifier to Advanced, e.g. If the dependent value is not picked up on a catalog variable, add the variable attribute Limit: variables inside and outside a multi-row variable set cannot be used in each other's dependent qualifiers. |
Variable reference qualifier:
The Script Include method returns an encoded query, e.g. Add |
Verified |
| 12 | Session putProperty / getProperty |
Server-side values kept for the user's session. |
Separate from the client-readable |
Later in the same session: |
Verified |
| 13 | User preferences | Persists a per-user value across sessions. |
Values are stored in the |
|
Verified |
| 14 | sysparm_query on a list URL |
Opens a pre-filtered list. |
Without the navigation frame: |
|
Verified |
| 15 | sysparm_view |
Forces a specific form view. |
Add View names (not labels) are in the Views [sys_ui_view] table. Switching views also saves a user preference, so the form reopens in that view. |
|
Verified |
| 16 | Event parms | Passes data from a script to a notification. |
Register the event, then call On the notification, set Send when = "Event is fired". Tick "Event parm 1 contains recipient" if parm1 holds recipients. Read values in the message as |
With "Event parm 1 contains recipient" ticked on the notification. |
Verified |
| 17 | Helper variables | Hidden values that drive UI Policies. |
Add a hidden checkbox or text variable, set it from a client script with Commonly used when the real condition depends on a GlideAjax result that a UI Policy cannot evaluate on its own. |
onLoad client script, after a GlideAjax callback:
UI Policy condition: "Is eligible" is true. |
Common practice |
| 18 | javascript: default value |
Computes a default value when the form loads. |
Right-click the field label, choose Configure Dictionary, and enter the script in Default value, e.g. For catalog variables, put the same kind of script in the variable's default value. |
Dictionary default on a reference-to-user field:
|
Verified |
| 19 | GlideDialogWindow.setPreference() |
Passes values into a UI Page opened as a dialog. |
In a client-side UI Action:
|
UI Action (client):
UI Page:
|
Verified, with caveats |
| 20 | $sp.getParameter() / $location.search() |
Reads URL parameters in a Service Portal widget. |
Server script: Client controller: inject |
Server script: Client controller: URL: |
Verified |
| 21 | $rootScope.$broadcast |
Passes data between widgets on a page. |
Sender: Receiver: Wrap the broadcast in a short |
Sender: Receiver: |
Verified |
Do you need a modern and powerful website for your business, startup or yourself ? Contact me!