s_kumar
Mega Contributor

hey Sidarth ..


My application scope is global ..... and yes i have checked client callable check box ...


and i am also not getting any error   but the output i am getting is NULL


Just remove the global. Refer to the modified script below:



var counttest = Class.create();


counttest.prototype = Object.extendsObject(AbstractAjaxProcessor, {


      counttest: function() {


              gs.info ('AAAA:This script is executing');


              var gr = new GlideRecord('incident');


              gr.query();


              if(gr.next())


                      { //Added this one


  gs.info("info");


              var datedif = gs.dateDiff(gr.sys_created_on,gs.nowDateTime(), false);


              gs.info('AAAA:'+datedif);


              return datedif;


      }


},


type: 'counttest'


});


s_kumar
Mega Contributor

Hi sidarth,



I have tried your script but now its giving following results.


1.PNG


which servicenow version are you using?


s_kumar
Mega Contributor

i am using Helsinki Version of Servicenow.