The CreatorCon Call for Content is officially open! Get started here.

Script Include not returning value

anilkumarkarams
Mega Contributor

Hi,

Can aynone help me out in identifying the error in the following code? My expectation is function should return value , but it is returning value

var IreturnInc = Class.create();

IreturnInc.prototype = Object.extendsObject(AbstractAjaxProcessor, {

  IreturnInc : function()

  {

  var incref = new GlideRecord('incident');

  incref.query();

  if(incref.next())

  return incref.number;

  },

      type: 'IreturnInc'

});

Please help.

Regards,

Anil Karamsetty

1 ACCEPTED SOLUTION

Thanks All for your Coordination. Code is working now. but surprisingly i did not make any changes to the code , i copied the code from my post and pasted in demo instance.


View solution in original post

11 REPLIES 11

Hi Travis,



I tried with the first option that you have mentioned. but i did not see any change in the result.



also , i do not know where i should check in service now , after capturing the log with console.log(response.responseXML); could you please help me in identifying the navigation so that i will go ahead and capture the log.




Regards,


Anil


Can you please update the below code and check in logs(System logs--->>All-->>search for Message contains Inside if incident number)



var IreturnInc = Class.create();


IreturnInc.prototype = Object.extendsObject(AbstractAjaxProcessor, {


  IreturnInc : function()


  {


  var incref = new GlideRecord('incident');


  incref.query();


  if(incref.next())


{


gs.log('Inside if incident number:'+incref.number);


  return incref.number;


}



  },


      type: 'IreturnInc'


});


Kalaiarasan Pus
Giga Sage

actually what are you trying to do ? This would query the entire incident table? Is that what you want to do ?


Hi Kalai,



I am learning Script Includes.So i wrote one sample program that would query Incident table and takes one incident and passes to client side script that would display when incident table loads.



I executed the same script include in Background script. it prompted me correct value. but it is not working when i wrote the same code in script include and client side script.



Regards,


Anil Kumar Karamsetty


Client callable is checked ? Can you share the client script?



Visited this page?


http://wiki.servicenow.com/index.php?title=GlideAjax