Courseiva

SNOW-CAD Practice Question: Automating application logic with business rules and scripts

Which script function is used to query the database in a business rule?

⚠ Common exam trap

ServiceNow often tests the distinction between static class references and instance methods, so the trap here is that candidates mistakenly think 'GlideRecord.query()' is valid because they confuse it with other static utility classes like 'GlideSystem' or 'GlideAggregate', forgetting that GlideRecord requires instantiation with 'new'.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

new GlideRecord('table').query();

In ServiceNow, a business rule must instantiate a new GlideRecord object using the 'new' keyword and then call the query() method on that instance to retrieve records from the database. The syntax 'new GlideRecord('table').query()' properly creates a GlideRecord object for the specified table and executes the query to fetch matching records.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • GlideRecord.query();

    Why it's wrong here

    Incorrect; query() must be called on an instance.

  • new GlideRecord('table').query();

    Why this is correct

    Correct; this creates a GlideRecord object and queries the table.

  • gs.query();

    Why it's wrong here

    Incorrect; gs.query() is not a valid function.

  • GlideRecord.newQuery();

    Why it's wrong here

    Incorrect; newQuery() is not a method.

About these practice questions

Courseiva writes every SNOW-CAD question from scratch — 481 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This SNOW-CAD practice question is part of Courseiva's free ServiceNow certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the SNOW-CAD exam.