Script Include not getting called
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2017 10:56 PM
Hi,
I am trying to call a script include through client script. but it is not getting called. Please advise.
Here is my client script:
**********************************************************
var ga=new GlideAjax('CreateINC');
ga.addParam('sysparm_name','create');
ga.addParam('sys_userName',g_user.userID);
ga.getXML(doSomething);
function doSomething(response){
var answer = response.responseXML.documentElement.getAttribute("answer");
alert(answer);
}
*****************************************************
Script Include:
********************************************************
var CreateINC = Class.create();
CreateINC.prototype = Object.extendsObject(AbstractAjaxProcessor, {
initialize: function() {
gs.log("Initialized","priyanka");
},
create: function(){
gs.log("INSIDE","priyanka");
var user=this.getParameter('sys_userName');
gs.log("User ="+user,"priyanka");
var inc = new GlideRecord('incident');
inc.initialize();
inc.short_description = 'New incident created by SR';
inc.caller_id=user;
var sysID=inc.insertWithReferences();
gs.log("SYSID ="+sysID,"priyanka");
return sysID;
},
type: 'CreateINC'
});
*******************************************************
In logs, I am getting initialized msg, but msg containing INSIDE is not getting. It means function is not getting called.
Client Callable is checked.
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2017 11:14 PM
Hi,
Have you marked the script include as client callable?
Thanks
PS: Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2017 11:17 PM
Ok, I see that you have checked it.
Why is the paramater sys_userName, should it be sysparm_userName ?
Thanks
PS: Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2017 11:18 PM
Yes i marked it as client callable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2017 11:24 PM
Please change sys_userName to sysparm_userName at all its references.
Thanks
PS: Hit like, Helpful or Correct depending on the impact of the response