how to write the Script include in service now

anilkumarsharma
Giga Guru

Hi Team,

i have wriiten bellow mention Script include   but when   i go to in Script include and paste the same then click on check then i got the error (ERROR at line 1: Expected an assignment or function call and instead saw an expression) Pls. Suggest

Var newinclude = Class.create();

  1. newinclude.prototype= {

Initialize : function(){

},

myFunction:function()

{

var t = gs.getUserID();

  1. gs.print("Print the value:" +t);

}

type: 'newinclude'

};

9 REPLIES 9

tanumoy
Tera Guru

Please go through the below link:



Script Includes - ServiceNow Wiki


tanumoy
Tera Guru

V should be in Lower Case in "Var" at 1st line.


now it working fine. Thanks for Update Sir


name of script include =newinclude



var newinclude = Class.create();


newinclude.prototype = {


 


  myFunction:function()


{


var t = gs.getUserID();



gs.print("Print the value:" +t);


},




      type: 'newinclude'


};



P.S- i have removed initialize function as it was not being used.


-Anurag