- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2015 11:54 PM
Hi,
I have a script include and catalog client script that instantiates and access the script include. Problem is, it does not return the value.
Script Include
==========
var acn_catalogClientScripts = Class.create();
acn_catalogClientScripts.prototype = {
initialize: function() {
this.errorMessage = "";
},
sampleFunction: function(){
return "SampleAnswer!";
},
type: 'acn_catalogClientScripts'
};
Catalog client script
=================
var validation = new gacn_catalogClientScripts();
var validation_result = validation.sampleFunction();
g_form.addErrorMessage("Value is " + validation_result);
validation_result does not return anything. Please help. Do I really have to use GlidAjax for this? As per my understanding, accessing script include can be done this way.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2015 01:59 AM
All i know is initialize is the function coming from super class and they mentioned on wiki like
- Avoid overriding methods of AbstractAjaxProcessor, including initialize. While it is possible to invoke methods of your superclass object which you have overridden, it is complicated and best avoided altogether.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2015 11:56 PM
Update*
var validation = new acn_catalogClientScripts();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2015 12:03 AM
To Call a Script include from a client script you have to use GlideAjax . Also Script include should be client callable .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2015 12:10 AM
But reading this article, I can access the script include without the GlideAjax
http://wiki.servicenow.com/index.php?title=Script_Includes#gsc.tab=0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2015 12:17 AM
Yes , You could do that if the calling statement is in Server side. Means you could call a script include directly from another script include , Business Rule , ACL Scripts or ny other server script but Client Scripts runs on Browser and in there you cannot call it in this way .. .,.. you have to use GlideAjax.