CAD practice question 22 of 35

In a privately-scoped application, which methods are used for logging messages in server-side scripts? (Choose 2 answers)

Full set: 264 questions
Answer options
A: gs.info() Correct answer
B: gs.debug()
C: gs.iog()
D: gs.error() Correct answer
E: gs.logError()
Correct Answer:
A. gs.info(); D. gs.error()
Explanation

Privately-scoped applications may log to the system log only with the GlideSystem (gs) methods that remain exposed in the scoped API. The scoped GlideSystem API list includes gs.info() and gs.error(), which write informational and error-level entries to the System Log. Methods such as log(), logError(), and debug() are deliberately removed or blocked to prevent excessive or insecure logging from a scoped app. Therefore, gs.info() and gs.error() are the two valid server-side logging functions for privately-scoped applications.

Why Incorrect

B. gs.debug() – The debug() method is not part of the scoped GlideSystem API; calls from a privately-scoped app are disallowed.
C. gs.iog() – No such GlideSystem method exists.
E. gs.logError() – logError() is excluded from the scoped API; attempting to use it in a private scope throws a script error.

References

1. ServiceNow Developer Site – GlideSystem (Scoped) API, “Method Summary” (Utah release): lists error() and info(); debug(), log(), logError() are absent.

2. ServiceNow Product Documentation – “Restricted server-side APIs in scoped applications” (Now Platform Scripting Guide, Utah), Table: “GlideSystem methods not available to scoped apps” – includes debug(), log(), logError().

(Exact URLs vary by release; navigate via Developer Site > API Reference > Server APIs > GlideSystem – Scoped.)

Scroll to Top