SNOW-CSA Self-Service and Automation Practice Question
Exhibit
Refer to the exhibit.
UI Policy condition:
```javascript
if (g_form.getValue('department') == 'IT' && g_form.getValue('category').indexOf('hardware') != -1) {
g_form.setMandatory('cost_center', true);
} else {
g_form.setMandatory('cost_center', false);
}
```A UI Policy is configured to run on load and on change for the department and category variables. When a user selects department 'IT' and category does not contain 'hardware', what is the behavior regarding the 'cost_center' variable?
⚠ Common exam trap
Test-takers frequently confuse 'does not contain' with 'is not' or 'does not equal', and may incorrectly assume the condition only applies when category is empty, or that the policy hides the field instead of just making it optional.
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 cost_center variable becomes optional
The UI Policy script sets the cost_center variable to optional only when the department is 'IT' and the category does not contain 'hardware'. The condition 'category does not contain hardware' is evaluated as true for any category value that does not include the substring 'hardware', triggering the 'mandatory=false' action on the cost_center variable. This makes the field optional (i.e., not required) when the condition is met.
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 cost_center variable is hidden
Why it's wrong here
The UI Policy does not hide the variable.
- ✗
The cost_center variable becomes mandatory
Why it's wrong here
Only when both conditions are true does mandatory become true.
- ✓
The cost_center variable becomes optional
Why this is correct
Since the condition is false, the else branch sets mandatory to false, making it optional.
- ✗
The cost_center variable becomes read-only
Why it's wrong here
The UI Policy does not set read-only; it sets mandatory.
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.