SNOW-CAD Working with Data Practice Question
A company needs to retrieve all active users whose department is 'Sales' and who have a manager assigned. They are using GlideRecord. Which script will correctly accomplish this?
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
✓
var gr = new GlideRecord('sys_user'); gr.addQuery('active', true); gr.addQuery('department', 'Sales'); gr.addQuery('manager', 'ISNOTEMPTY'); gr.query();
It correctly adds queries for active = true, department = 'Sales', and manager ISNOTEMPTY, then executes query() to retrieve all matching records. Option A is incorrect because getRow() is not a valid GlideRecord method. Option C lacks the manager condition. Option D incorrectly uses get() which retrieves a single record by sys_id, not a query.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
var gr = new GlideRecord('sys_user'); gr.addQuery('active', true); gr.addQuery('department', 'Sales'); gr.addQuery('manager', 'ISNOTEMPTY'); var rows = gr.getRow();
Why it's wrong here
getRow() is not a valid GlideRecord method.
- ✓
var gr = new GlideRecord('sys_user'); gr.addQuery('active', true); gr.addQuery('department', 'Sales'); gr.addQuery('manager', 'ISNOTEMPTY'); gr.query();
Why this is correct
Correctly uses addQuery with ISNOTEMPTY for manager.
- ✗
var gr = new GlideRecord('sys_user'); gr.addQuery('active', true); gr.addQuery('department', 'Sales'); gr.query();
Why it's wrong here
Missing condition for manager; returns all Sales users regardless of manager.
- ✗
var gr = new GlideRecord('sys_user'); gr.get('active', true); gr.get('department', 'Sales'); gr.get('manager', 'ISNOTEMPTY');
Why it's wrong here
Using `gr.get()` multiple times is incorrect for this scenario because each subsequent call overwrites the previous condition, meaning only the final `manager` query would be applied, not a combination of all three. `gr.get()` is designed to retrieve a single record based on a single query, often using a unique identifier. This option is tempting as it appears to add filtering criteria, but `gr.addQuery()` is the correct method to combine multiple conditions to filter a record set and retrieve all matching records, which is required here.
Go deeper
Related to this question
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 →
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.