Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

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

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

I may not be able to remember this shortkey. Is there a way to open the executor in menu item?