What are the different ways to call client side from server side and vice versa?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday
With Now Assist, the way client–server interactions are handled shifts slightly compared to classic GlideAjax/g_scratchpad.
🔄 Client → Server in Now Assist
-
The Now Assist client component (for example, in Agent Workspace or Employee Center) .
-
Instead, it calls GenAI Providers or GenAI Actions which are defined server-side.
-
Behind the scenes, ServiceNow uses Data Brokers
-
You can still fall back on GlideAjax or REST APIs, but Now Assist favors the Action Framework for structured server calls.
🔄 Server → Client in Now Assist
-
Responses from the server are not raw field values or XML like in GlideAjax.
-
The server (through Actions, GenAI Providers, or Scripted APIs) returns structured JSON, which Now Assist renders into the conversation or workspace UI.
-
You can enrich the response with UI Actions (e.g., “Update Incident Priority”), which then invoke client-side components automatically.
✅ Key Difference vs. Classic Model
-
Classic client–server: developer explicitly wires GlideAjax or g_scratchpad.
-
Now Assist: developer defines Actions/Providers, and the platform handles the client–server call lifecycle.
-
Instead of thinking in terms of “call this Script Include”, you think in terms of “expose this action to the AI”.
👉 So when we talk about client ↔ server in Now Assist, the main difference is abstraction:
You still have server-side scripts and client-side rendering, but Now Assist routes everything through its Action & Provider framework rather than direct GlideAjax.
- GlideRecord & GlideAjax: Client-Side Vs. Server-Side.
- ServiceNow Client-Side vs Server-Side (video).
- ServiceNow Code and Beyond: Client-Side vs Server-Side Scripting in ServiceNow.
- Client & Server Code in One UI Action.
- Client and Server-side Programming.
- What is Client-Side and Server-Side Scripting in ServiceNow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday - last edited Wednesday
Hi @SahanaR ,
- GlideAjax → Script Include: Client side uses GlideAjax to asynchronously call server side logic via Script Include...
- getReference: Client side can fetch full related record details without a GlideRecord query....
- g_scratchpad (via Display Business Rule): Preloads server side data for client-side access when the form loads....
- UI Action (combined): UI Actions can include both client and server side code, toggled via the Client checkbox....
- Portal Widgets (c.server.get): Within Service Portal, client controllers call c.server.get, handled by corresponding server scripts....
If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday - last edited Wednesday
Hi @SahanaR ,
Calling Server-Side from Client-Side:
- GlideAjax: A client script uses GlideAjax to call a server-side Script Include, which then performs server-side operations (e.g., database queries, calculations) and returns data to the client. This allows for dynamic updates without a full page refresh.
- getReference() (with callback): We have a client side method getreference() which can be used for fetching data from a referenced record. Recommendation is to call use it with callback function which will make it asynchronous and prevent UI blocking. Withotut callback method, it is not recommended.
Calling Client-Side from Server-Side:
- g_scratchpad (via Display Business Rule): This is used to pass data from the server to the client when a form loads. A Display Business Rule can populate the g_scratchpad object with server-side data, which can then be accessed by client scripts (e.g., onLoad client scripts).But remember it will be only when form is loaded not after that (Dynamic data fetching – Glideajax can be used to get dynamic data)
- UI Actions (Client-side and Server-side Scripting in one):
A UI Action can be configured to run both client-side and server-side code. The "Client" checkbox determines if client-side code is executed. Within the script, you can use if (typeof window == 'undefined') to differentiate between server-side and client-side execution contexts.
Further details for 4th point can be seen here:-
and the last method is - through portal widgets.
Regards,
Nikhil Bajaj