GlideElement - changesTo(Object value)

Determines if the new value of a field, after a change, matches the specified object.

Note: If the GlideRecord on which you are performing this method has only been initialized and read, and has not been written, the underlying before-and-after values are the same. In this case, the method returns "false", as there has been no change to the data store.
Table 1. Parameters
Name Type Description
value Object An object value to check against the new value of the current field.
Table 2. Returns
Type Description
Boolean True if the new value matches the parameter, false if it does not.

Scoped equivalent

To use the changesTo() method in a scoped application, use the corresponding scoped method: Scoped GlideElement - changesTo(Object o).

if (theState.changesTo(resolvedState)) {
  operation = 4; //Resolved
else if (theState.changesTo(closedState)) {
  operation = 11; //Resolution Accepted
else if (theState.changesFrom(resolvedState) || theState.changesFrom(closedState)) {
  operation = 10; //Re-open
else {
  operation = 6; //Update