onload client script not working on custom table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2025 05:26 PM
Hi Experts,
I have a custom table where I have written an onLoad client script, but it is not working. I even tried just adding alert('message'), but it still doesn't work. Please suggest a solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2025 08:40 PM
share the script and client script config screenshot.
Also did you ensure UI type - ALL?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2025 09:28 PM
function onLoad() {
alert("Client Script Loaded!"); /
var CoordinatorSysId = g_form.getValue('u_coordinator');
alert("u_site_ebs_coordinator: " + CoordinatorSysId);
if (CoordinatorSysId) {
var ga = new GlideAjax('CMSUtils');
ga.addParam('sysparm_name', 'getTeam');
ga.addParam('sysparm_Coordinator', CoordinatorSysId);
ga.getXML(_handleResponse);
}
function _handleResponse(response) {
var team = response.responseXML.documentElement.getAttribute("answer");
alert("Received Team: " + team);
if (team) {
g_form.setValue('u_team', team);
} else {
g_form.clearValue('u_team');
}
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2025 09:33 PM - edited ‎02-13-2025 09:34 PM
Try the below
function onLoad() {
alert("Client Script Loaded!");
var CoordinatorSysId = g_form.getValue('u_coordinator');
alert("u_coordinator: " + CoordinatorSysId);
if (CoordinatorSysId) {
var ga = new GlideAjax('CMSUtils');
ga.addParam('sysparm_name', 'getTeam');
ga.addParam('sysparm_Coordinator', CoordinatorSysId);
ga.getXML(_handleResponse);
}
function _handleResponse(response) {
try {
var team = response.responseXML.documentElement.getAttribute("answer");
alert("Received Team: " + team);
if (team) {
g_form.setValue('u_team', team);
} else {
g_form.clearValue('u_team');
}
} catch (e) {
alert('Error processing response: ' + e.message);
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2025 09:45 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2025 09:51 PM
Hi @raja_5 ,
have you checked if your script include is marked for all accessible from all application scopes and as well as check in which scope it is?
Mark the accessible from to all application scope and as well as share your script include script