Trying to write my first javascript for script include and it doesn't work.

PJ363182
Tera Contributor

aa.JPG

bb.JPG

cc.JPG

   

Are you able to assist?

 

Thanks

 

1 ACCEPTED SOLUTION

Chaitanya ILCR
Mega Patron

Hi @PJ363182 ,

check the Sandbox enable checkbox it'll work

 

ChaitanyaILCR_2-1741661844357.png

 

ChaitanyaILCR_1-1741661788144.png

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

View solution in original post

9 REPLIES 9

Community Alums
Not applicable

Hi @PJ363182 ,

What are you trying to get from the script include here?

You can learn more from the link below and then try again :

https://developer.servicenow.com/dev.do#!/learn/learning-plans/yokohama/new_to_servicenow/app_store_...

 

Live example :https://www.servicenow.com/community/developer-forum/way-to-create-script-include/m-p/2480639

 

The expectation is that the result would show only 1 record with Abel Tuter.

Chaitanya ILCR
Mega Patron

Hi @PJ363182 ,

check the Sandbox enable checkbox it'll work

 

ChaitanyaILCR_2-1741661844357.png

 

ChaitanyaILCR_1-1741661788144.png

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

Medi C
Giga Sage
Giga Sage

Hi @PJ363182,

 

Your script include is Client Callable. Could you please recreate your script include with Client Callable unchecked?

For your filter, please use Name IS javascript: new a().aa(); as the user table and your script include are both on Global Scope.

Try calling your function on scripts - background to see if everything is working as expected:

 

var util = new a();
gs.info(util.aa());

 


If you found this helpful, please hit the thumbs-up button and mark as correct. That helps others find their solutions.