SNOW-CAD Core Application Development Practice Question
Exhibit
Refer to the exhibit.
Business Rule script:
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord('incident');
gr.addQuery('category', 'network');
gr.query();
while (gr.next()) {
gr.setValue('priority', 2);
gr.update();
}
})(current, previous);The Business Rule above runs on the 'incident' table. It is set to run 'before' update. What is the most likely issue with this script?
⚠ Common exam trap
ServiceNow often tests the concept of recursive loops in Business Rules, and the trap here is that candidates focus on syntax or object usage (like 'current' vs 'gr') instead of recognizing that any update to the same table within a before/after update rule will cause recursion unless explicitly prevented.
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
✓
The script will cause a recursive loop because it updates incident records within a Business Rule that runs on the same table.
Updating the same table (incident) within a 'before update' Business Rule that runs on that table creates a recursive loop. Each time the script calls gr.update() on an incident record, it triggers the same Business Rule again, leading to infinite recursion until the system enforces a governor limit or stack overflow. ServiceNow detects and prevents such loops by throwing an error, but the design is fundamentally flawed.
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 script should use 'current' instead of 'gr' to update records.
Why it's wrong here
The script is intended to update multiple records, not just the current one.
- ✗
The script has a syntax error: missing semicolon after the while loop.
Why it's wrong here
The while loop does not require a semicolon after the closing brace.
- ✓
The script will cause a recursive loop because it updates incident records within a Business Rule that runs on the same table.
Why this is correct
Updating incident records inside a before update Business Rule on incident can trigger the rule again.
- ✗
The script does not commit the changes because it uses 'gr.update()' instead of 'current.update()'.
Why it's wrong here
gr.update() commits changes to the database.
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.