Howto add new Ticket State

Hello to all,

is there any finale tutorial on how to add a new ticket status? Best via the web GUI.
I´m running Zammad in Version 3.1 on CentOS 7.

Thanks in Advance
Marc

Not via UI, but via console:
https://docs.zammad.org/en/latest/console/working-on-tickets.html#add-new-ticket-state

Hi all,

the status of my newly created ticket state is unvisible. Is see the new state in the drop-down menu.
But if i assign this state to a ticket, i cant see it in the overview anymore. What did i wrong?



The way i added the new state:

  • zammad run rails c
  • Ticket::State.create_or_update(
    id: 8
    name: ‘warten auf Rückmeldung’,
    state_type: Ticket::StateType.find_by(name: ‘pending reminder’), ### to get the ticket marked grey (or is there another way?)
    ignore_escalation: true,
    created_by_id: 1,
    updated_by_id: 1,
    )
  • attribute = ObjectManager::Attribute.get(
    object: ‘Ticket’,
    name: ‘state_id’,
    )
    attribute.data_option[:filter] = Ticket::State.by_category(:viewable).pluck(:id)
    attribute.screens[:create_middle][‘ticket.agent’][:filter] = Ticket::State.by_category(:viewable_agent_new).pluck(:id)
    attribute.screens[:create_middle][‘ticket.customer’][:filter] = Ticket::State.by_category(:viewable_customer_new).pluck(:id)
    attribute.screens[:edit][‘ticket.agent’][:filter] = Ticket::State.by_category(:viewable_agent_new).pluck(:id)
    attribute.screens[:edit][‘ticket.customer’][:filter] = Ticket::State.by_category(:viewable_customer_edit).pluck(:id)
    attribute.save!
  • reboot server

Thx, Daniel.

P.S.: The new state is not listet with Ticket:StateType.all:

Two things:
Please don’t recycle old threads, because this worsens overview of things for both, people trying to help and people trying to find solutions. :slight_smile:

Secondly: In this special case, the output of your console would have been perfec. Ignoring the fact that Zammad version and installation type would be useful as well. :wink:

The ticket was not closed yet and only one month old… That’s why I assumed that it fits the theme. :slight_smile:
There were no error messages during the creation of the new status. Unfortunately I don’t have anything in my cache anymore. We are using centos 7 with zammad 3.1.x…

Is there a command to delete this state? So i can try it again and can post the console output.

P.S.: This is ID 8 output, which i´ve deactivated now => #<Ticket::State id: 8, state_type_id: 3, name: “warten auf Rückmeldung”, next_state_id: nil, ignore_escalation: true, default_create: false, default_follow_up: false, note: nil, active: true, updated_by_id: 1, created_by_id: 1, created_at: “2019-09-05 14:52:31”, updated_at: “2019-09-05 15:35:10”>

Here is the output for the new state:

[root@dre-ts-01 ~]# zammad run rails c
Loading production environment (Rails 5.2.3)
irb(main):001:0> ^C
irb(main):001:0> Ticket::State.create_or_update(
irb(main):002:1* name: ‘warten auf Rückmeldung’,
irb(main):003:1* state_type: Ticket::StateType.find_by(name: ‘closed’),
irb(main):004:1* created_by_id: 1,
irb(main):005:1* updated_by_id: 1,
irb(main):006:1* ignore_escalation: true,
irb(main):007:1* )
=> #<Ticket::State id: 9, state_type_id: 5, name: “warten auf Rückmeldung”, next_state_id: nil, ignore_escalation: true, default_create: false, default_follow_up: false, note: nil, active: true, updated_by_id: 1, created_by_id: 1, created_at: “2019-09-06 08:49:15”, updated_at: “2019-09-06 08:49:15”>
irb(main):008:0> attribute = ObjectManager::Attribute.get(
irb(main):009:1* object: ‘Ticket’,
irb(main):010:1* name: ‘state_id’,
irb(main):011:1* )
=> #<ObjectManager::Attribute id: 6, object_lookup_id: 2, name: “state_id”, display: “State”, data_type: “select”, data_option: {“relation”=>“TicketState”, “nulloption”=>true, “multiple”=>false, “null”=>false, “default”=>2, “translate”=>true, “filter”=>[2, 1, 3, 4, 6, 7, 8], “maxlength”=>255}, data_option_new: {}, editable: false, active: true, screens: {“create_middle”=>{“ticket.agent”=>{“null”=>false, “item_class”=>“column”, “filter”=>[2, 1, 3, 4, 7, 8]}, “ticket.customer”=>{“item_class”=>“column”, “nulloption”=>false, “null”=>true, “filter”=>[1, 4], “default”=>1}}, “edit”=>{“ticket.agent”=>{“nulloption”=>false, “null”=>false, “filter”=>[2, 1, 3, 4, 7, 8]}, “ticket.customer”=>{“nulloption”=>false, “null”=>true, “filter”=>[2, 4], “default”=>2}}}, to_create: false, to_migrate: false, to_delete: false, to_config: false, position: 40, created_by_id: 1, updated_by_id: 1, created_at: “2019-08-15 09:38:05”, updated_at: “2019-09-05 15:41:01”>
irb(main):012:0> attribute.data_option[:filter] = Ticket::State.by_category(:viewable).pluck(:id)
=> [2, 1, 3, 4, 6, 7, 8, 9]
irb(main):013:0> attribute.screens[:create_middle][‘ticket.agent’][:filter] = Ticket::State.by_category(:viewable_agent_new).pluck(:id)
=> [2, 1, 3, 4, 7, 8, 9]
irb(main):014:0> attribute.screens[:create_middle][‘ticket.customer’][:filter] = Ticket::State.by_category(:viewable_customer_new).pluck(:id)
=> [1, 4, 9]
irb(main):015:0> attribute.screens[:edit][‘ticket.agent’][:filter] = Ticket::State.by_category(:viewable_agent_new).pluck(:id)
=> [2, 1, 3, 4, 7, 8, 9]
irb(main):016:0> attribute.screens[:edit][‘ticket.customer’][:filter] = Ticket::State.by_category(:viewable_customer_edit).pluck(:id)
=> [2, 4, 9]
irb(main):017:0> attribute.save!
ObjectManager::Attribute.find(6) notify UPDATED 2019-09-06 08:49:41 UTC
=> true

After i go to the overview is saw the new state for about 2 seconds… Then it just vanished. :thinking:

WOW, i have found the solution… And it can be so easy… Don’t forget to display the new status in the overview settings. My bad… Sorry for making you crazy. :wink:

Oh sorry, I didn’t follow the right road to understand what the real Problem was.
Glad you could solve it though!