Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Script Include not getting called

priyankapalaska
Giga Contributor

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.

10 REPLIES 10

Alikutty A
Tera Sage

Hi,



Have you marked the script include as client callable?





Thanks


PS: Hit like, Helpful or Correct depending on the impact of the response


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


Yes i marked it as client callable


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