Calling script include from UI Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2025 06:05 AM
Hi Everyone,
I am calling script include from UI Script. The script include is client callable and I placed gs.info in start of script include, but I cannot see gs.info in logs.
UI Script:
alert('This is test message');
var ar = new GlideAjax('x_cc_aa.myScriptInclude');
ar.addParam('sysparm_name', 'setDetails');
ar.addParam('sysparm_sysID', 'ed92e8d173d023002728660c4cf6a7bc');
ar.addParam('sysparm_table', 'incident');
ar.addParam('sysparm_contact_sysID', '77ad8176731313005754660c4cf6a7de');
ar.getXMLAnswer(setURLCallback);
function setURLCallback(response) {
alert(response);
var params = 'scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no,width=1000,height=550,left=180,top=100';
var newWin = top.window.open(response, '_blank', params);
newWin.opener = null;
}
Script Include:
var myScriptInclude = Class.create();
myScriptInclude .prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
setDetails: function() {
var callUrl = "https://www.google.com/"
return callUrl;
},
type: 'myScriptInclude '
});
Can we call script include into UI Script.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2025 06:09 AM
yes you can call
both UI script and script include are in same scope?
If not then if script include is in other scope then are you calling it with correct scope prefix? Is it made accessible from all application scopes?
share some details and screenshots.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2025 06:45 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2025 07:26 AM
unless your UI script is marked as global it won't run on form load etc
are you sure client callable checkbox is checked?
what's your actual business requirement?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2025 08:51 AM
Hi @Ankur Bawiskar,
While creating UI script in scoped application, I don't see Global checkbox. Whereas when I try to create UI script in global then I can see Global checkbox.
Thanks