CAD practice question 1 of 35

Which options are strategies for debugging client-side scripts? Choose 2 answers

Full set: 264 questions
Answer options
A: gs.addErrorMessage()
B: g_form.addInfoMessage() Correct answer
C: gs.log()
D: jslog() Correct answer
Correct Answer:
B. g_form.addInfoMessage(); D. jslog()
Explanation

Client-side scripts execute in the browser, so debugging must use APIs that run on the client.
• gform.addInfoMessage() inserts an informational banner at the top of the form, allowing a script writer to surface variable values or execution points directly to the user interface.
• jslog() writes messages to the JavaScript Log window (opened from Application Navigator → System Diagnostics → JavaScript Log), giving real-time diagnostic output while the script runs in the browser. Both functions are explicitly documented for client-side troubleshooting and do not require a round-trip to the server.

Why Incorrect

A. gs.addErrorMessage() – GlideSystem API; executes only in server-side scripts (Business Rules, Script Includes), unavailable in the browser.
C. gs.log() – Another GlideSystem (server-side) logging method; cannot be called from Client Scripts or UI Policies.

References

1. ServiceNow Developer Site, “gform.addInfoMessage(message)” – Client-side API description and example (Utah release), Section: gform API, paragraph 1.

2. ServiceNow Product Documentation, “JavaScript Log” – Debugging client-side code; states “Use jslog() to output messages to this log.” (Rome release)

3. ServiceNow Docs, “Debugging client scripts” – Notes that gs. methods are server-side only, unsuitable for client debugging (Paris release, para. 2).

Scroll to Top