Add a new state change condition using a script include

To add new criteria for state transitions, you can edit the script includes for the state transition models of each change type.

About this task

You can add state change criteria to determine the UI actions that enable a particular state to transition to the next state.

Procedure

  1. Go to System Definitions > Script Includes.
  2. Open the script include for the state transition model that you want to edit.
    State transition modelScript include
    Normal ChangeRequestStateModel_normal
    Standard ChangeRequestStateModel_standard
    Emergency ChangeRequestStateModel_emergency
  3. Modify the appropriate method canMove method in the script include.
    For example, to add a condition for a normal change to transition from the New state to the Authorized state, modify the draft.authorized.canMove() method in the ChangeRequestStateModel_normal script include. In the script, the GlideRecord you are acting on can be referenced using the this._gr variable.

    The canMove method is part of a structure that defines the transitions available to the change type. The canMove method is contained in the currentState.nextState.canMove() structure.