Zammad: Objects Manager add new State

Created on 2 Jan 2017  ·  25Comments  ·  Source: zammad/zammad

In the object manager, I can not create a new ticket status. If you click the manger / Tickets object, everything is not clickable

duplicate

Most helpful comment

So you say API is wrong in this case? Maybe it should be noted in documentation?

You also can use the REST API to do this changes.

-=> Our goal is to cover it via the UI. So this is just a small mini howto/workaround unit the UI is available.

All 25 comments

Could someone explain to me how I can add a new status. I need the status "Solved".

For any help I would be very grateful

UPDATE:

I have added a new TicketState in the documentation via API interface. The new status does not appear.

{
    "id": 11,
    "state_type_id": 10,
    "name": "In Bearbeitung",
    "next_state_id": null,
    "ignore_escalation": true,
    "note": "In Bearbeitung",
    "active": true,
    "updated_by_id": 3,
    "created_by_id": 3,
    "created_at": "2017-01-02T21:13:27.003Z",
    "updated_at": "2017-01-02T21:13:27.003Z"
}

states

+1
I also added new status via api but it doesn't show up. What could be wrong?

I also need a state "Work in progress" :+1:

In the meantime a small howto/workaround to add a new state via rails console (our goal is to cover it via the UI):

Add a new state, let's say "customer feedback":

rails c
Ticket::State.create_or_update(
  name: 'customer feedback',
  state_type_id: Ticket::StateType.find_by(name: 'open').id,
  ignore_escalation: true,
  created_by_id: 1,
  updated_by_id: 1,
)

As second you need to tell the ticket state attribute to allow it to select, here is a example, please take care (in case you are not know what you are going to do, create an database backup first)!

ObjectManager::Attribute.add(
  force: true,
  object: 'Ticket',
  name: 'state_id',
  display: 'State',
  data_type: 'select',
  data_option: {
    relation: 'TicketState',
    nulloption: true,
    multiple: false,
    null: false,
    default: Ticket::State.find_by(default_follow_up: true).id,
    translate: true,
    filter: Ticket::State.by_category(:viewable).pluck(:id),
  },
  editable: false,
  active: true,
  screens: {
    create_middle: {
      'ticket.agent' => {
        null: false,
        item_class: 'column',
        filter: Ticket::State.by_category(:viewable_agent_new).pluck(:id),
      },
      'ticket.customer' => {
        item_class: 'column',
        nulloption: false,
        null: true,
        filter: Ticket::State.by_category(:viewable_customer_new).pluck(:id),
        default: Ticket::State.find_by(default_create: true).id,
      },
    },
    edit: {
      'ticket.agent' => {
        nulloption: false,
        null: false,
        filter: Ticket::State.by_category(:viewable_agent_edit).pluck(:id),
      },
      'ticket.customer' => {
        nulloption: false,
        null: true,
        filter: Ticket::State.by_category(:viewable_customer_edit).pluck(:id),
        default: Ticket::State.find_by(default_follow_up: true).id,
      },
    },
  },
  to_create: false,
  to_migrate: false,
  to_delete: false,
  position: 40,
)

So you say API is wrong in this case? Maybe it should be noted in documentation?

So you say API is wrong in this case? Maybe it should be noted in documentation?

You also can use the REST API to do this changes.

-=> Our goal is to cover it via the UI. So this is just a small mini howto/workaround unit the UI is available.

Our goal is to cover it via the UI. So this is just a small mini howto/workaround unit the UI is available.

+1 for this UI enhancement

+1 for this UI enhancement

is there a way to access new created states via api?
like query search state:newone ?

i've created 2 more states and they are working fine but need api access

@skibson Trying to make this change via API the following response is returned:

"error": "Attribute not editable!"

What do you have to alter to make a second or third state visible?
It's only working for the first state we ever added via rails.

NVM restarting Zammad did it..

But is there a way to make the state behave like the "pending reminder" one? I want to add a date related to the state.

Setting the state type to the same type as "pending reminder" didn't work.

@martini

I'm getting the following error when i followed your steps:

SyntaxError: (irb):11: syntax error, unexpected tIDENTIFIER, expecting ')' name: 'state_id',

Any idea why?
I'm on zammad 2.3
Thanks!

@AchuM Maybe you forgot the last closing ")" parentheses. Try checking on that. 😊

Hi @AchuM - seems there was an issue while copy pasting the content into the console. I would recommend to past the content into a file in your $ZAMMAD_DIR like e.g. $ZAMMAD_DIR/add_state.rb and execute it via rails r add_state.rb from your $ZAMMAD_DIR.

Seems you missed a comma in front of the described line name: 'state_id',.

Yes! ) was my mistake 🙈

@thorsteneckel That's a very good tip, Thanks! I will do that until we have this via UI

Thank you!

@martini @thorsteneckel Is there a way to completely disable state selection for customers? Thanks!

@martini how would you translate those rails shell commands to pure Elasticsearch API calls?
Having installed the DEB package calling /opt/zammad/bin/rails c returns dependencies errors and, not being accustomed to ruby, I can't add a new state.

@gualican have you seen https://docs.zammad.org/en/latest/admin-console.html ? regards

@martini do you know when does the UI for the state will be available? We would also like to set the color of the state.

In additional we would also like that user are not able to change the state of a ticket. They often select a wrong one, only agent should be able to do it.

+1 for this feature as well.

+1 for this Feature

+1

Locking the conversation for now, as this issue hasn't received any usefull comments in the past, but just +1s.

I'll close this issue since technically it's a duplicate of #1525. We describe how you can already add states via the Zammad Rails console in the documentation until we resolve #1525. Closing now.

Was this page helpful?
0 / 5 - 0 ratings