Script Includes Questions

Build reusable server-side JavaScript libraries with Script Includes. Learn to extend classes, create client-callable scripts, and implement the AbstractAjaxProcessor pattern.

20 total questions2 free questions

Newest question added: AI-assisted drafts, not yet individually reviewedHow questions are made

About Script Includes

Script Includes are reusable server-side JavaScript objects that are loaded on demand. They promote code reuse and maintainability by encapsulating logic in class-based structures. Client-callable Script Includes enable client-server communication through the GlideAjax framework, following the AbstractAjaxProcessor pattern.

Why This Matters for Your Exam

Questions focus on creating and using Script Includes, extending base classes, making Script Includes client-callable, and understanding scope implications.

Key Concepts to Master

Master the Script Include structure with initialize() and prototype patterns. Understand how to extend AbstractAjaxProcessor for client-callable Script Includes. Know the difference between scoped and global Script Includes and when each is appropriate.

Exam Tips

Remember that client-callable Script Includes must extend AbstractAjaxProcessor and have the 'Client callable' checkbox selected. The getParameter() method retrieves values passed from GlideAjax. Script Includes are loaded on demand — they don't execute until called.

Practice Questions

20 questions available
1
application

A developer has copied the same server-side date calculation into several business rules. They want to store it once as a reusable function that other server scripts can call. What should they create?

AA script include that server scripts can call
BA global business rule holding the shared function
CAn onLoad client script on each form that needs it
DA UI policy that runs the logic when the form changes

👆 Click an option above to select your answer

Show answer and explanation

Correct answer: A. A script include that server scripts can call

Script includes store JavaScript that runs on the server; you create them to hold functions and classes for use by server scripts. Each one defines a single class or function that other scripts call, which fits shared logic used by several business rules.

  • Why B is wrong: The docs recommend script includes instead of global business rules for this, because script includes are only loaded on request when code calls them.
  • Why C is wrong: Client scripts run JavaScript in the web browser on form events such as load. They cannot serve as a shared function for server-side business rules.
  • Why D is wrong: UI policies change form behavior, such as making fields mandatory, read-only, or hidden, on the client. They do not provide reusable server-side functions.
2
application

A developer builds a script include in a scoped application and wants only scripts in that same application to be able to call it. Which setting on the Script Include form does this?

AGlide AJAX enabled and Mobile callable both cleared
BAccessible from set to This application scope only
CProtection policy set to Protected
DAccessible from set to All application scopes

👆 Click an option above to select your answer

Show answer and explanation

Correct answer: B. Accessible from set to This application scope only

The Accessible from field sets which applications can access the script include. Its This application scope only value means the script include can be accessed only from the current application scope, so scripts in other applications cannot call it.

  • Why A is wrong: Glide AJAX enabled makes the script include available to client scripts, list/report filters, reference qualifiers, or URLs, and Mobile callable makes it available to client scripts on mobile devices. Clearing them does not limit which application scopes can call it.
  • Why C is wrong: Protection policy Protected hides the contents of the Script field from customers who download the script include. It protects the code from being viewed; it does not control which application scopes can call it.
  • Why D is wrong: All application scopes is the opposite setting: it lets the script include be accessed from any application scope, including other applications.