SNOW-CAD Designing interfaces and user experiences Practice Question
Exhibit
// Widget server script
data.items = [];
var gr = new GlideRecord('incident');
gr.query();
while(gr.next()) {
data.items.push(gr.getRow());
}Refer to the exhibit. The developer expects a list of incidents in the widget, but the page renders with an error. What is the most likely cause?
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
✓
getRow() is not a valid method on GlideRecord
The error occurs because getRow() is not a valid method on GlideRecord. The correct method to access field values from a GlideRecord object is getValue(). Option A is not the most likely cause because server scripts do not require an explicit return statement; the data structure is implicitly returned. Option C is a logic issue, not a syntax error. Option D is incorrect because the data.items array is correctly initialized with new Array() or [] and then pushed in the loop.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The server script is missing a return statement
Why it's wrong here
Incorrect: Server scripts should assign to data, not return.
- ✓
getRow() is not a valid method on GlideRecord
Why this is correct
Correct: getRow() is not a GlideRecord method; it causes a script error.
- ✗
The query does not filter for active incidents
Why it's wrong here
Incorrect: This would not cause an error, just empty data.
- ✗
The data.items array is not initialized correctly
Why it's wrong here
Incorrect: The array is initialized correctly as an empty array.
Go deeper
Related to this question
About these practice questions
One of 481 original SNOW-CAD practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.