- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2016 10:01 AM
I am trying to call Script Include from UI Script in scoped application. Surprisingly UI script unable to contact with Script Include. Script Include is accessible from all applications.
Ui Script:
function loadMyItineraries3()
{
var ga = new GlideAjax('loadMyItineraries');
ga.addParam('sysparm_name','loadItineraries');
ga.getXML(getResponse);
}
function getResponse(response)
{
var responseString = response.responseXML.documentElement.getAttribute("answer");
alert(responseString);
}
Script include:
var loadMyItineraries = Class.create();
loadMyItineraries.prototype = Object.extendsObject(global.AbstractAjaxProcessor,
{
loadItineraries : function ()
{
gs.log('Inside loadItineraries Function');
var i=0;
var list=[];
var gr=new GlideRecord('XXXXXXXXXXXXXXXX');
gr.addQuery('entered_by',gs.getUserID());
gr.query();
while(gr.next())
{
var data=gr.group.getDisplayValue()+'\t'+gr.number+'\t'+gr.traveler.getDisplayValue()+'\t'+gr.post.getDisplayValue()+'\t'+gr.start_date+'\t'+gr.end_date+'\t'+gr.sys_updated_on+'\t'+gr.status+'\n';
list[i++]=data;
}
gs.log('List '+list.toString());
return list.toString();
}
});
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2016 07:40 AM
Hi jpavanaryan,
A few things to note:
1. You have a Script Include and UI Script which provides functions that can call that Script Include, using GlideAjax. You still need to get that UI Script onto a form or page. I assume you have a Client Script which loads the UI Script via the ScriptLoader, or that you are using this in a UI Page and have directly added the appropriate <script> tag to that page, to bring the UI Script in?
2. gs.log() is not available to scoped scripts. There is a scoped logging API you can use instead.
3. If you check your node log files when testing the above scripts, as-is, you should find exceptionslike this:
WARNING *** WARNING *** Function log is not allowed in scope x_yourscope. Use gs.debug() or gs.info() instead
com.glide.script.fencing.MethodNotAllowedException: Function log is not allowed in scope x_yourscope. Use gs.debug() or gs.info() instead
at com.glide.script.fencing.ScopedScriptableObject.checkWhitelistAccess(ScopedScriptableObject.java:131)
at com.glide.script.fencing.ScopedScriptableObject.shouldAllow(ScopedScriptableObject.java:99)
at com.glide.script.fencing.WrappedScriptableObject.get(WrappedScriptableObject.java:57)
If you ensure that you are actually bringing your UI Script into the page, and that you are using the Scoped Logging API, your code should work.
Thanks
Cory
[Edited to add links to the scoped logging API]

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2016 10:07 AM
And it's "Client Callable" too, yes?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2016 10:11 AM
Yes, it is client callable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2016 07:40 AM
Hi jpavanaryan,
A few things to note:
1. You have a Script Include and UI Script which provides functions that can call that Script Include, using GlideAjax. You still need to get that UI Script onto a form or page. I assume you have a Client Script which loads the UI Script via the ScriptLoader, or that you are using this in a UI Page and have directly added the appropriate <script> tag to that page, to bring the UI Script in?
2. gs.log() is not available to scoped scripts. There is a scoped logging API you can use instead.
3. If you check your node log files when testing the above scripts, as-is, you should find exceptionslike this:
WARNING *** WARNING *** Function log is not allowed in scope x_yourscope. Use gs.debug() or gs.info() instead
com.glide.script.fencing.MethodNotAllowedException: Function log is not allowed in scope x_yourscope. Use gs.debug() or gs.info() instead
at com.glide.script.fencing.ScopedScriptableObject.checkWhitelistAccess(ScopedScriptableObject.java:131)
at com.glide.script.fencing.ScopedScriptableObject.shouldAllow(ScopedScriptableObject.java:99)
at com.glide.script.fencing.WrappedScriptableObject.get(WrappedScriptableObject.java:57)
If you ensure that you are actually bringing your UI Script into the page, and that you are using the Scoped Logging API, your code should work.
Thanks
Cory
[Edited to add links to the scoped logging API]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2016 10:06 AM
I am using this with Content Pages. I know gs.log() does not work in Scoped app (found out while testing in background scripts), but still I was blind. Thanks Cory for saving my day.