SNOW-CSA Service Catalog and Workflows Practice Question
Exhibit
function onLoad() {
g_form.setValue('category', 'software');
}Refer to the exhibit. A catalog client script with the above code runs on load of a catalog item. Which statement is true?
⚠ Common exam trap
ServiceNow often tests the distinction between `onLoad` (runs every time the form loads) and `onChange` (runs only when a specific field changes), leading candidates to mistakenly think `onLoad` scripts run only under certain conditions like user interaction or field visibility.
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 run on every page load and set the category to 'software'.
The `onLoad` catalog client script runs every time the catalog item form is loaded, and the code `g_form.setValue('category', 'software')` unconditionally sets the category field to 'software' on each load. This overrides any previous value or user input from a prior session, ensuring the field is always set to 'software' when the form renders.
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 category variable will be set to 'software' only if the user does not change it.
Why it's wrong here
The script runs on load and sets the value before the user interacts.
- ✓
The script will run on every page load and set the category to 'software'.
Why this is correct
onLoad runs each time the form loads, unconditionally setting the value.
- ✗
The script will cause an error because onLoad should use g_form.setDisplay.
Why it's wrong here
There is no such requirement; setValue is valid in onLoad.
- ✗
The script will only run if the variable 'category' is visible.
Why it's wrong here
The script does not check visibility; it runs regardless.
Go deeper
Related to this question
About these practice questions
This SNOW-CSA question is part of Courseiva's 504-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-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.