gs.log not working in script include

e_wilber
Tera Guru

I have a very simple script include and I can't get the gs.log to work so I'm not even sure if it's being called correctly.

Below is the script include named cab with function cabCheck.

find_real_file.png

 

In the report I am calling this using javascript: new cab().cabCheck() and javascript: new cab.cabCheck(). In reviewing the log files, I do not see "cab check" anywhere so I don't know if the report is actually calling my script include or if gs.log doesn't work in it or if the script include isn't set up right.

Any ideas what's not working?

11 REPLIES 11

Try using

 

new cab().cabCheck() instead of new cab.cabCheck()

 

Thanks,

Jaspal Singh

 

Hit Helpful or Correct on the impact of response.

Where did you want to call that script include? If you want to call that from scoped application then you will change accessible from field from this application to all application and try with what Patel would suggest you.

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Wilber,

Is that report also in same scope?

Your script include is in global scope and if your report is in another scope then it won't work since accessible from on script include is this application scope only

Valid syntax to call in report is

javascript: new cab().cabCheck();

Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Yes, both the report and the include are in the same global scope.

I did try javascript: new cab().cabCheck(); with and without the semi colon.

I also set Accessible From to All application scopes for the script include.

Mrigank Gupta
Giga Expert

If its scope issue then user new global.cab().cabCheck();

Since you are using from client side, it should be client callable and the AbstractAjaxProcessor should be extended in the script include.

 

var cab = Class.create();
cab.prototype = Object.extendsObject(AbstractAjaxProcessor, {
	cabCheck : function(){
		gs.log();
	},

    type: 'cab'
});