Which options are strategies for debugging client-side scripts? (Choose 2 answers)
Correct Answer: A,C
Comprehensive and Detailed Step-by-Step Explanation:
* Client-Side Debugging Context:Client-side scripts, such as Client Scripts or UI Policies, run in the browser. Debugging these scripts requires tools and methods that interact directly with the client-side environment.
* Valid Options for Debugging:
* g_form.addInfoMessage():This method displays an informational message on the form, which is useful for providing immediate feedback to the user or debugging purposes. Example:
g_form.addInfoMessage('This is a test message.');
* jslog():This method logs messages to the browser's JavaScript console, which is an essential tool for debugging client-side scripts. Example:
jslog('Debugging message: Variable X = ' + x);
* Incorrect Options Explained:
* gs.addErrorMessage() (Option B): This is a server-side method and cannot be used in client- side scripts.
* gs.log() (Option D): Similarly, this is a server-side method and is not applicable for debugging client-side scripts.
References:
* ServiceNow Developer Documentation on Client Scripts.