Working with ticket information

Note

Please note that this is not a full command list, if you’re missing commands, feel free to ask over at the Community.

Get the RAW mail that Zammad fetched

The following command will help you to check on received EML-files Zammad fetched. This comes in handy if you delete Mails upon fetching and you need to check the EML-file itself.

To get the first articles EML-file, you can use the following command. In our example the ticket number in question is 101234.

>> Ticket.find_by(number:'101234').articles.first.as_raw.content

If needed, you can also get the raw content of later articles (you’ll need to find the correct article though). Again, we expect 101234 to be our ticket number. In the first step we get all article IDs of the ticket, from the list we get, we can then get the articles content.

>> Ticket.find_by(number:'101234').article_ids
=> [4, 3, 2]
>> Ticket::Article.find(3).as_raw.content

Note

If you just use Ticket::Article.find(3) you can see further information (like who sent the mail, when we fetched it, …).

Update all tickets of a specific customer

Warning

Please note that this action can be expensive resource wise, if you have many tickets, this might slow down Zammad.

>> Ticket.where(customer_id: 4).update_all(customer_id: 1)

Get ticket state types

This will show all state types needed for creating new ticket states.

Tip

What are state types?

Zammad uses state types to know what it should do with your state. This allows you to have different types like pending actions, pending reminders or closed states.

State types also indicate the color scheme to be used. You can learn more about that in our user documentation.

If you want to add custom states, have a look in our admin documentation section.

>> Ticket::StateType.pluck(:id, :name)

Above will return both, the type ID and name - e.g.: [[1, "new"], [2, "open"], ....