Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

How to test a piece of javascript quickly?

Lei Wang3
Giga Expert

How to test a piece of javascript quickly? 

Do you have to test it in client ui policy or business rule? fix script? which is quick and convenient? for example, to query GlideRecord?

 

1 ACCEPTED SOLUTION

Javascript Executor is only for client-side code, and you shouldn't use GlideRecord in client-side code.

If you are just trying to test the js executor, try this simple line

alert("Hello from the Javascript Executor");

 

To learn more about scripting, I highly recommend this

https://developer.servicenow.com/dev.do#!/learn/courses/tokyo/app_store_learnv2_scripting_tokyo_scri...

 

and 

https://www.youtube.com/watch?v=62Nabpb94Jw

View solution in original post

12 REPLIES 12

RaghavSh
Mega Patron

Background script is the quickest and easiest.


Please mark the answer correct/helpful accordingly.


Raghav
MVP 2023
LinkedIn

Mike_R
Kilo Patron
Kilo Patron

For server side - background scripts. 
For client side - JavaScript executor. 

how to access JS executor from NOW? or where is it?

On any form or list view,

press and hold Alt+Ctrl+Shift+j