- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi all,
I was reading the ServiceNow on-demand course material for Module 7 (Script Includes), and it says that both "Define a New Class" and "Extend an Existing Class" can be called from both server-side and client-side scripts.
But every article, community post, and documentation I've found says that for client-side access you must extend AbstractAjaxProcessor. No one shows a plain "Define a New Class" being called from the client.
So which one is correct — the course material or the community?
My theory is that the course material is technically correct. AbstractAjaxProcessor is itself just a Script Include containing functions like getParameter(), newItem(), and HTTP request/response handling. If someone manually copied all of that code into their own "Define a New Class" Script Include and checked "Glide AJAX enabled," it should work from the client side — because the actual capability comes from the code inside AbstractAjaxProcessor, not from the act of extending it.
So theoretically a "Define a New Class" can work with the client. Practically nobody would ever do this because that's the whole point of extending — you don't copy-paste 50 lines when one line of Object.extendsObject() does the same thing.
Is this understanding correct?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
57m ago
Hi @TharaS657398130 , thanks for the replies. I tested this myself on my PDI. Here are the results:
I created 3 Script Includes, all with "Glide AJAX enabled" checked, and called each from a Client Script using GlideAjax.
Test 1 — Extending AbstractAjaxProcessor: Worked. Returned the value.
Test 2 — "Define a New Class" with AbstractAjaxProcessor's code manually copied into it (process, getParameter, initialize, etc.): Worked. Returned the value.
Test 3 — Plain "Define a New Class" with no AbstractAjaxProcessor code at all: Failed. Returned null.
Then I unchecked "Glide AJAX enabled" on Test 2 and tried again: Failed. Returned null.
So the answer is: both the checkbox AND the AbstractAjaxProcessor code are required. You can either extend it or copy its code manually — both work. But without the code, it fails. And without the checkbox, it also fails.
The course material is technically correct. A "Define a New Class" can work from the client if it contains AbstractAjaxProcessor's logic. But practically, everyone extends it because why copy 50 lines when one line of Object.extendsObject() does the same thing.
Thanks though
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Your understanding is close, but not fully correct
While the course material sounds like any Script Include (even a “Define a New Class”) can be called from the client, in reality client-side calls using GlideAjax only work when the Script Include extends AbstractAjaxProcessor
If you could create your own class and copy code, it won’t work from the client unless your Script Include extends AbstractAjaxProcessor, because ServiceNow only recognizes those classes for GlideAjax calls; the special behavior (like handling requests and parameters) comes from the platform itself, not just the code, so a normal “Define a New Class” cannot be called from the client—this is why everyone uses AbstractAjaxProcessor.
In ServiceNow when you check the Client callable box on a Script Include, the system automatically modifies the prototype to extend the AbstractAjaxProcessor class.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
57m ago
Hi @TharaS657398130 , thanks for the replies. I tested this myself on my PDI. Here are the results:
I created 3 Script Includes, all with "Glide AJAX enabled" checked, and called each from a Client Script using GlideAjax.
Test 1 — Extending AbstractAjaxProcessor: Worked. Returned the value.
Test 2 — "Define a New Class" with AbstractAjaxProcessor's code manually copied into it (process, getParameter, initialize, etc.): Worked. Returned the value.
Test 3 — Plain "Define a New Class" with no AbstractAjaxProcessor code at all: Failed. Returned null.
Then I unchecked "Glide AJAX enabled" on Test 2 and tried again: Failed. Returned null.
So the answer is: both the checkbox AND the AbstractAjaxProcessor code are required. You can either extend it or copy its code manually — both work. But without the code, it fails. And without the checkbox, it also fails.
The course material is technically correct. A "Define a New Class" can work from the client if it contains AbstractAjaxProcessor's logic. But practically, everyone extends it because why copy 50 lines when one line of Object.extendsObject() does the same thing.
Thanks though
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
your understanding is correct but they are talking about different levels
My thoughts
-
Course material: Technically correct at the JavaScript level
- Any Script Include could be callable from the client if it implements the required Ajax handling logic.
-
Reality in ServiceNow: Community guidance is correct
- Client-side calls via GlideAjax are supported only when extending
AbstractAjaxProcessor.
- Client-side calls via GlideAjax are supported only when extending
-
Why this works:
AbstractAjaxProcessoris just a Script Include that already implements:- parameter parsing (
sysparm_*) - request/response handling
- helper methods like
getParameter()
- parameter parsing (
-
Theoretical vs practical:
- You could reimplement all of that in a “Define a New Class” Script Include
- But this is unsupported, fragile, and unnecessary
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Thank you for marking my response as helpful.
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
