Chapter 12. Modifying ticket states and ticket state types

It is possible to change the predefined states and state types for tickets in OTRS. Also new states or state types can be added and used with the ticket system. Two options are important for a state, the name (state-name) and the type of the state (state-type).

In the section for states in the admin area of OTRS the name of allready existing states can be changed or new states can be added. If the state "new" has been changed via the web interface, this change also has to be configured via the config file Kernel/Config.pm or via the SysConfig interface. The following settings have to be modified to ensure that OTRS works with the changed state for "new":

    [...]
    # PostmasterDefaultState
    # (The default state of new tickets.) [default: new]
    $Self->{PostmasterDefaultState} = 'new';

    # CustomerDefaultState
    # (default state of new customer tickets)
    $Self->{CustomerDefaultState} = 'new';
    [...]

If the state "open" has been changed, the configuration of OTRS also has to be modified to ensure that OTRS uses the new settings:

    [...]
    # default phone new state
    $Self->{'Ticket::Frontend::PhoneNextState'} = 'open';

    # PostmasterFollowUpState
    # (The state if a ticket got a follow up.) [default: open]
    $Self->{PostmasterFollowUpState} = 'open';
    [...]

If a new state type should be added the ticket_state_type table in the OTRS database needs to be modified with a database client program.

linux:~# mysql -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 23 to server version: 5.0.16-Debian_1-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use otrs;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> insert into ticket_state_type (name,comments) values ('own','Own
state type');
Query OK, 1 row affected (0.00 sec)

mysql> quit
Bye
linux:~#

Now it is possible to use the new state type "own" via the web interface in the section for states in the admin area. After a state has been linked with this new state type also the configuration of OTRS has to be changed to ensure that the new state is used. Just modify your configuration files or use the SysConfig interface to change the following settings:

    [...]
    # Ticket::DefaultNextMoveStateType
    # default move next state
    $Self->{'Ticket::DefaultNextMoveStateType'} = ['open', 'closed'];

    # next possible states after phone
    $Self->{'Ticket::PhoneDefaultNextStateType'} = ['open', 'pending auto', 'pending reminder', 'closed'];

    # default next state
    $Self->{'Ticket::Frontend::PhoneNextState'} = 'closed successful';

    # default next state [default: open]
    $Self->{'Ticket::Frontend::PhoneNewNextState'} = 'open';

    # next possible states after email
    $Self->{'Ticket::EmailDefaultNextStateType'} = ['own-state', 'open', 'pending auto', 'pending reminder', 'closed'];

    # default next state
    $Self->{'Ticket::Frontend::EmailNewNextState'} = 'open';

    # (default note next state)
    $Self->{'Ticket::DefaultNextNoteStateType'} = ['new', 'open', 'closed'];

    # Ticket::DefaultNextOwnerStateType
    # (default note next state)
   $Self->{'Ticket::DefaultNextOwnerStateType'} = ['open', 'closed'];

    # default compose next state
    $Self->{'Ticket::DefaultNextComposeType'} = 'open';

    # next possible states for compose message
    $Self->{'Ticket::DefaultNextComposeStateType'} = ['open', 'closed', 'pending auto', 'pending reminder'];

    # default bounce next state
    $Self->{'Ticket::Frontend::BounceState'} = 'closed successful';

    # next possible states for bounce message
    $Self->{'Ticket::DefaultNextBounceStateType'} = ['open', 'closed'];

    # next possible states for forward message
    $Self->{'Ticket::DefaultNextForwardStateType'} = ['open', 'closed'];

    # Ticket::ViewableStateType
    # (see http://yourhost/otrs/index.pl?Action=AdminState -> StateType)
    $Self->{'Ticket::ViewableStateType'} = ['new', 'open', 'pending reminder', 'pending auto'];

    # Ticket::UnlockStateType
    # (Tickets which can be unlocked by bin/UnlockTickets.pl
    # (see http://yourhost/otrs/index.pl?Action=AdminState -> StateType)
    $Self->{'Ticket::UnlockStateType'} = ['open', 'new'];
    [...]

Just add your new state to the config settings where the new state should be used.