Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

[MOD] Custom Ticket Status in 1.10.1 (change when agent/client replies)

edited November 2017 in Mods and Customizations

i want to achieve 3 different ticket states to get a better overview of all our tickets:
  • Open
    only for new, unanswered tickets
  • In Progress
    with two sub-status:
    - In Progress (Action required by Support-Team)
    - In Progress (Action required by Customer)
  • Closed
    with the default:
    - Closed
    - Resolved
In my point of view i need to do the following:
  1. Add the statuses at: Admin Panel -> Manage -> Lists -> Ticket Statuses
  2. Make sure that the ticket status is set to "In Progress (Action required by Customer)" by default when an agent replies:
    DONE (this just selects always this status by default in the drop down field - see attachment)

    If someone is interested in this, here is what i changed (green color). Please note that you will have to find out the ID of the status you want to set via your database (table os_ticket_status or similar, depending on your prefix "os_").
    foreach (TicketStatusList::getStatuses(
       array('states' => $states)) as $s) {
           if (!$s->isEnabled()) continue;
    +      $current = ($statusId == $s->getId()); //added this line
    +~     $selected = ('8' == $s->getId()); //changed this line

           echo sprintf('<option value="%d" %s>%s%s</option>',
                        $selected ? 'selected="selected"' : '',
                        $current ? (' ('.__('current').')') : '' //renamed variable here
  3. Make sure that the ticket status is set to "In Progress (Action required by Support-Team)" by default when a customer replies:
    Which file do i need to edit here? Simplest solution would be to change the SQL Query when the reply gets written in the database, but i can't find the right file.
Thank you for your help!


  • Hello!

    Have you managed to do this?

    I could use it very well.

    Thank you
    Best regards
  • Hi

    no, not yet. I still need to figure out which file i need to edit.
    Any help would be appreciated :)

    Best regards
  • You could achieve this with a plugin easily, rather than modifying core. Intercept the thread entry creation signal and change the ticket status accordingly.
  • Hi Grizly,

    could you please give me an advice on how to intercept the thread entry creation signal?

    Thank you!
  • Hey chief, checkout for an example of intercepting/using the ThreadEntry Signal.

    To change a ticket's status, you'll need to load the desired TicketStatus object and apply it to the Ticket object, example here:

    Loading TicketStatus from config:
    Applying TicketStatus to Ticket:

    You don't have to do it that way, if you know exactly which ones you want to alternate between, you could use something like:
    // Check if this thread entry was created by clients:
    if ($entry instanceof MessageThreadEntry) {
        $new_status = TicketStatus::lookup('id_of_waiting_for_agent_status');
    elseif ($entry instanceof ResponseThreadEntry) {
        $new_status = TicketStatus::lookup('id_of_waiting_for_client_status');
    else {
    // this is a system message or NoteThreadEntry, so we should assume this shouldn't change the state
    // don't change if already the same status:
    if ($ticket->getStatusId() != $new_status->getId()) {
        $ticket->status = $new_status;

    So, if you make a new plugin, use the Bootstrap method to listen for Signal 'threadentry.created', then run the above on the $entry. The fun part is fetching the Ticket from the $entry. The slack plugin above includes a method that fetches it from the $entry, you might want to grab a copy.

    Let me know if you need a hand, or if you're having trouble getting it going, if you want to use a Plugin Config screen, you can copy those from my plugins too, (they even include examples of Status drop-downs!). 
    There are examples of logging the Event in the thread in the Closer Plugin, which might be useful for statistics later on.

Sign In or Register to comment.