The answer is that the script is missing the function parameters (options, data) required to access the data object. In ServiceNow widget server scripts, the function signature must explicitly include these two parameters; without them, the data variable remains undefined, so any property like data.count will display 'undefined' on the widget. This concept is frequently tested on the ServiceNow Certified Application Developer CAD exam, often appearing as a trick where the server script runs without errors but fails to pass the data object to the client script. A common trap is assuming the data object is automatically available, when in fact it must be declared in the function definition. Remember the mnemonic "Options and Data are the gatekeepers"—if you forget them, your data stays undefined.
SNOW-CAD User Interface Development Practice Question
This SNOW-CAD practice question tests your understanding of user interface development. Read the scenario carefully and evaluate each option against the stated constraints before committing to an answer. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.
Exhibit
Refer to the exhibit.
Server script in a Service Portal widget:
(function() {
var gr = new GlideRecord('incident');
gr.addQuery('active', true);
gr.query();
var count = 0;
while (gr.next()) {
count++;
}
data.count = count;
})();
A developer runs this widget server script and expects data.count to be the number of active incidents. However, the widget displays 'undefined' for data.count. What is the most likely cause?
Clue words in this question
Noticing these words before you look at the options changes how you read each choice.
Clue: "most likely"
Why it matters: Probability qualifier — the question wants the most probable cause or outcome, not a guaranteed one. Eliminate low-probability options.
Refer to the exhibit.
Server script in a Service Portal widget:
(function() {
var gr = new GlideRecord('incident');
gr.addQuery('active', true);
gr.query();
var count = 0;
while (gr.next()) {
count++;
}
data.count = count;
})();
A
The addQuery method syntax is incorrect; it should use a condition string.
Why wrong: addQuery('active', true) is valid syntax.
B
The while loop uses next(); it should use hasNext() instead.
Why wrong: next() is correct to iterate.
C
The script is missing the function parameters (options, data) that provide the data object.
Without parameters, data is not defined in the closure.
D
GlideRecord requires an initialize() call before query.
Why wrong: GlideRecord constructor initializes the object.
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
The script is missing the function parameters (options, data) that provide the data object.
In ServiceNow widget server scripts, the function signature must include the parameters (options, data) to access the data object that is passed to the client script. Without these parameters, the data variable is undefined, causing data.count to display 'undefined'. The script likely defines the function without parameters or with incorrect ones, so the data object is not available.
Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
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 addQuery method syntax is incorrect; it should use a condition string.
Why it's wrong here
addQuery('active', true) is valid syntax.
✗
The while loop uses next(); it should use hasNext() instead.
Why it's wrong here
next() is correct to iterate.
✓
The script is missing the function parameters (options, data) that provide the data object.
Why this is correct
Without parameters, data is not defined in the closure.
Clue confirmation
The clue word "most likely" in the question point toward this answer.
Related concept
Read the scenario before looking for a memorised answer.
✗
GlideRecord requires an initialize() call before query.
Why it's wrong here
GlideRecord constructor initializes the object.
Common exam traps
Common exam trap: answer the scenario, not the keyword
ServiceNow often tests the requirement for explicit function parameters in widget server scripts, trapping candidates who assume data is globally accessible or who focus on GlideRecord syntax errors instead of the missing parameter signature.
Detailed technical explanation
How to think about this question
The widget server script runs server-side and must explicitly accept the (options, data) parameters to receive the data object that is automatically passed by the ServiceNow widget framework. Without these parameters, the data variable is not defined in the function scope, leading to undefined errors. This is a common oversight when developers assume data is globally available, but the framework strictly passes it as a function argument.
KKey Concepts to Remember
Read the scenario before looking for a memorised answer.
Find the constraint that changes the correct option.
Eliminate answers that are true in general but not in this case.
TExam Day Tips
→Watch for words such as best, first, most likely and least administrative effort.
→Review why wrong options are wrong, not only why the correct option is correct.
Key takeaway
Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Real-world example
How this comes up in practice
A small business has 20 workstations on the 192.168.1.0/24 network and one public IP from its ISP. The router uses PAT (NAT overload) so all 20 devices share one public address using different source ports. NAT questions test whether you understand the four address terms and which direction each translation applies.
What to study next
Got this wrong? Here's your next step.
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
User Interface Development — This question tests User Interface Development — Read the scenario before looking for a memorised answer..
What is the correct answer to this question?
The correct answer is: The script is missing the function parameters (options, data) that provide the data object. — In ServiceNow widget server scripts, the function signature must include the parameters (options, data) to access the data object that is passed to the client script. Without these parameters, the data variable is undefined, causing data.count to display 'undefined'. The script likely defines the function without parameters or with incorrect ones, so the data object is not available.
What should I do if I get this SNOW-CAD question wrong?
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
Are there clue words in this question I should notice?
Yes — watch for: "most likely". Probability qualifier — the question wants the most probable cause or outcome, not a guaranteed one. Eliminate low-probability options.
What is the key concept behind this question?
Read the scenario before looking for a memorised answer.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. A service portal widget is supposed to load data from a table and display it in a list. The widget renders but shows no data. Which is the most likely cause?
medium
A.The table's ACL denies read access to the user.
B.The widget's client script has a syntax error.
C.The portal page is not configured to include the widget.
✓ D.An error in the widget's server script prevents data from being queried.
Why D: Option A is correct because the server script in the widget is responsible for querying data; if it has an error, no data is returned. Option B is wrong because ACL issues would typically cause an error message or empty result but less common than script errors. Option C is wrong because client script errors would affect interactivity, not initial loading. Option D is wrong because the portal page configuration is usually fine if the widget renders.
Last reviewed: Jun 30, 2026
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
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.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.