SNOW-CAD Practice Question: Automating application logic with business rules and scripts
A developer wants to use a business rule to prevent a user from saving an incident if the short description is empty. Which script should be used?
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
✓
current.setAbortAction(true); gs.addErrorMessage('Short description required');
The proper order is to call `current.setAbortAction(true)` first to abort the save, then use `gs.addErrorMessage()` to display an error message. Option A is incorrect because it uses `gs.addInfoMessage()` for an informational message instead of an error, which does not properly indicate a validation failure. Option B is incorrect both because it reverses the order (the error message may not display after abort) and uses `addInfoMessage`. Option C is incorrect because it reverses the order: the error message is added before the abort action, which may cause the message to be lost. Only D uses the correct order and the correct method for error messages.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
current.setAbortAction(true); gs.addInfoMessage('Short description required');
Why it's wrong here
Incorrect; addInfoMessage does not indicate an error.
- ✗
gs.addInfoMessage('Short description required'); current.setAbortAction(true);
Why it's wrong here
Incorrect; wrong message type and order.
- ✗
gs.addErrorMessage('Short description required'); current.setAbortAction(true);
Why it's wrong here
Incorrect; the error message might not be shown because the abort action is set after.
- ✓
current.setAbortAction(true); gs.addErrorMessage('Short description required');
Why this is correct
Correct; setAbortAction stops the save and then the error message is displayed.
Go deeper
Related to this question
About these practice questions
This SNOW-CAD question is part of Courseiva's 481-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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.