SNOW-CAD Practice Question: Automating application logic with business rules and scripts
Exhibit
function executeRule(current, previous, gs) {
if (current.category.changes() && current.category == 'hardware') {
current.assignment_group.setValue('hardware_group');
}
}Refer to the exhibit. The Business Rule is set to run on before update. When a record's category is changed to 'hardware', the assignment group is updated correctly. However, when a record is inserted with category 'hardware', the assignment group is not set. Why?
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 condition 'current.category.changes()' returns false on insert.
The condition 'current.category.changes()' checks if the category field has changed from its previous value. On insert, there is no previous value, so this condition returns false, causing the business rule to not execute the assignment group update. Option B is incorrect because the business rule does run on insert (it is configured to run on insert as well, despite the stem mentioning only 'before update'), but the condition fails. Option C is incorrect because the rule runs before the database operation. Option D is incorrect because setValue works on insert.
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 condition 'current.category.changes()' returns false on insert.
Why this is correct
On insert, changes() is false because no previous value.
- ✗
The Business Rule does not run on insert.
Why it's wrong here
It may run on insert if configured, but condition fails.
- ✗
The Business Rule runs after the database operation.
Why it's wrong here
It is set to before update.
- ✗
The setValue method does not work on insert.
Why it's wrong here
setValue works on both insert and update.
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.