SNOW-CSA Service Catalog and Workflows Practice Question
Exhibit
Refer to the exhibit.
```javascript
// Catalog Client Script - onChange on variable 'department'
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') { return; }
if (newValue == 'IT') {
g_form.addOption('cost_center', 'IT_CC', 'IT Cost Center');
} else {
g_form.clearOptions('cost_center');
}
}
```Refer to the exhibit. A catalog item has a variable 'department' (choice list with values 'IT', 'HR', 'Finance') and a variable 'cost_center' (choice list initially empty). The client script is supposed to add an option to 'cost_center' when 'department' is set to 'IT'. However, when a user selects 'IT', no new option appears. What is the most likely reason?
⚠ Common exam trap
It's easy for candidates to assume any variable with a choice list is a 'Choice' variable, but ServiceNow distinguishes between the variable type (which must be 'Choice') and the presence of choice records; the `g_form.addOption()` method only works on variables with the correct underlying type.
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 variable 'cost_center' is not a 'Choice' variable type.
The `g_form.addOption()` method only works on variables of type 'Choice' (or similar select-type variables like 'Select Box'). If 'cost_center' is not a Choice variable, the client script cannot dynamically add options to it, and the method call silently fails or has no effect. In ServiceNow, only choice-based variable types support runtime option manipulation via client-side APIs.
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 variable 'cost_center' is not a 'Choice' variable type.
Why this is correct
addOption only works on choice-type variables.
- ✗
The script is a server-side script and cannot use 'g_form'.
Why it's wrong here
Client scripts use g_form.
- ✗
The script needs to call 'g_form.clearOptions()' before adding options.
Why it's wrong here
clearOptions is already called in the else branch, but not needed before addOption.
- ✗
The method should be 'g_form.addOption()' with different syntax.
Why it's wrong here
Syntax is correct.
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.