SNOW-CAD Core Application Development Practice Question
Exhibit
Refer to the exhibit.
Exhibit (Business Rule script):
```javascript
(function executeRule(current, previous /*null when async*/) {
if (current.state == 1 && previous.state == 2) {
gs.addErrorMessage('State change is not allowed');
current.setAbortAction(true);
}
})(current, previous);
```What happens when a user changes the state from '2' to '1' on an incident record?
⚠ Common exam trap
Many candidates confuse 'before' business rules with 'after' rules, mistakenly thinking that `setAbortAction` only works in 'after' rules or that a missing return statement causes the rule to be ignored.
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 record is not saved and an error message 'State change is not allowed' is displayed.
In a 'before' business rule, calling `current.setAbortAction(true)` prevents the database operation from completing and displays the error message specified in `gs.addErrorMessage()`. When the state changes from '2' to '1', the script checks for this condition and aborts the save, showing 'State change is not allowed'. This is a standard pattern for enforcing state transition restrictions in ServiceNow.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Nothing happens because the script does not have a return statement.
Why it's wrong here
The script does not need a return; setAbortAction works.
- ✗
The record is saved without any message because setAbortAction is ignored in 'before' rules.
Why it's wrong here
setAbortAction is valid in 'before' Business Rules.
- ✗
The record is saved and a message 'State change is not allowed' is shown.
Why it's wrong here
setAbortAction(true) prevents the save.
- ✓
The record is not saved and an error message 'State change is not allowed' is displayed.
Why this is correct
The condition matches, so the action is aborted and error shown.
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.