SNOW-CSA Service Catalog and Workflows Practice Question
Exhibit
Catalog Client Script: 'Validate Email' on variable 'email' (type: email)
Script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var pattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
if (!pattern.test(newValue)) {
g_form.showFieldMsg('email', 'Invalid email format', 'error');
g_form.setValue('email', '');
}
}
Variable: 'email' (type: email, mandatory: true)
Catalog Item: 'Contact Us'Refer to the exhibit. A user enters 'user@example' into the email field and tabs out. What happens?
⚠ Common exam trap
A common mix-up: candidates assume the native 'email' field type handles all validation automatically, but ServiceNow allows custom scripts to override or extend validation, and the script in this question explicitly clears the field on failure.
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 field shows an error message 'Invalid email format' and the entered value is cleared.
The script runs on blur (when the user tabs out) and validates the email format. Since 'user@example' lacks a top-level domain (e.g., .com), it fails RFC 5322 validation, triggering the 'Invalid email format' error message and clearing the field value as defined in the script logic.
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 only runs on load.
Why it's wrong here
Incorrect. The script runs onChange, not only on load.
- ✗
The form is submitted successfully because the field type is email.
Why it's wrong here
Incorrect. The client script runs client-side and prevents submission with error.
- ✓
The field shows an error message 'Invalid email format' and the entered value is cleared.
Why this is correct
Correct. The script shows the error and clears the field.
- ✗
The field shows an error message but the entered value remains.
Why it's wrong here
Incorrect. The script explicitly sets the value to empty string.
Go deeper
Related to this question
About these practice questions
Courseiva writes every SNOW-CSA question from scratch — 504 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-CSA 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-CSA exam.