CIS-ITSM practice question 18 of 25
The current status of a problem record is tracked in the State field. Each state has a label, value and constant. This example is for Fix in Progress state: Your customer wants to add a prerequisite for moving out of the Fix in Progress state. When you update the script include which value is better to use in the script?
Full set: 172 questionsUsing the constant ProblemState.STATES.FIXINPROGRESS is the ServiceNow best practice for scripting. This approach makes the code more readable and maintainable. It abstracts the underlying integer value (104), so if the value changes in the future (e.g., during a system upgrade or customization), the script will not break. The logic remains tied to the constant's meaningful name, and only the central ProblemState script include would need to be updated, ensuring system-wide consistency.
A. 104: This is a "magic number." Using hardcoded integer values makes code difficult to read and maintain. If the state value changes, the script will fail.
B. "Fix in Progress": Using the display value string is unreliable. It can change due to administrative preference or language translation, which would break the script logic.
D. 104.ProblemState.STATES.FIXINPROGRESS: This is syntactically incorrect and not a valid way to reference an object property or constant in JavaScript.
1. ServiceNow Developer Documentation - Coding best practices: In the "Server-side scripting" section, it advises against hardcoding values. "Avoid hard-coded sysids and magic numbers. Do not hard-code sysids, table names, or other values in scripts. Instead, use a property or a script include to store and retrieve the value." This directly supports using a constant from a script include (Option C) over a magic number (Option A).
2. ServiceNow Product Documentation - ProblemStateSNC script include: This official documentation describes the read-only script include that defines the constants for problem states. It lists constants such as DRAFT, ASSESS, ROOTCAUSEANALYSIS, FIXINPROGRESS, etc., confirming their intended use in scripts to refer to problem states. This validates that ProblemState.STATES.FIXINPROGRESS is the correct and intended method.
Keep practicing
Take the free CIS-ITSM practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other CIS-ITSM practice questions
- Question 1What are the different ways a user can provide feedback on a knowledge article? Choose 4 …
- Question 2Where can a change manager define the interval frequency for unauthorized change detectio…
- Question 3Which of the following roles has the ability to create and manage user criteria for servi…
- Question 4On a Normal Change Model what are some examples of the Model Stale Transitions that are d…
- Question 5Which should be used to explore the entire hierarchy and table definitions of the Configu…
- Question 6A new Problem Coordinator accidentally created several problem investigations that need t…
