Final answer:
The preferred method for evaluating change request states in a script include is using the state name constant, like ChangeRequestStateHandler.SCHEDULED, for better readability and maintainability of code. A. Use the state name constant, such as ChangeRequestStateHandler.SCHEDULED
Step-by-step explanation:
When evaluating change request states in a script include, the preferred method for referencing a state is to use the state name constant, such as ChangeRequestStateHandler.SCHEDULED. This method is preferred because it makes the code more readable and maintainable by using meaningful names rather than arbitrary values that might not be self-explanatory. Additionally, state constants are less likely to change than numerical IDs, which can minimize the risk of errors if the underlying State field values are modified in the system.
Using the State field value like -2 can lead to confusion and less maintainable code, because it's not clear what state the numerical value corresponds to at first glance. The .getDisplayValue function is used to get a human-readable value of a field and is not as reliable for use in scripts that act on specific states. Finally, the g_form.getValue function is used in client scripts or when a reference to the form object is available, and it would not be applicable within a server-side Script Include.