Forums/Documentation/Searching the data in your Zendesk

Searching tickets

Anton de Young
posted this on June 30, 2011 09:44

Full text searches return results from all the data in your Zendesk. To search exclusively for ticket data, you can use ticket property keywords.

status:open

In the example above,statusis the keyword andopenis the value. This search returns all the tickets with status set to open. This of course directly maps to the ticket fields and their values.

You can combine these keyword search statements to narrow your results even further.
status:open group:"Level 2"

This returns all the open tickets that are assigned to the Level 2 support group.

Note: For a quick reference to all data that can be searched, see Zendesk search reference.

The ticket property keywords and their values that you can use in your searches are described in the following table. Not all of the ticket data is searchable. Administrators and agents can search for tickets using these keywords.

Table 1. Searchable ticket properties
KeywordDescription
Ticket ID
There isn't a property keyword for the ticket ID. Instead, you simply search for the ticket by its ID number in the following format:
233
created The date the ticket was created.
created:2011-05-01
updated The date of the most recent ticket update.
updated>2011-05-15
solved The date the ticket was set to solved.
solved<2011-06-01
due_date The due date of tickets with type set to Task.
due_date:2011-06-01
assignee The assigned agent.
assignee:"Susan Warren"
submitter The ticket submitter. This may be different than the requester if the ticket was submitted by an agent on behalf of the requester. You can use the user's name, email address, or the 'me' keyword. See Searching ticket user roles.
submitter:me
requester The ticket requester.
requester:amy@mondocam.com
subject The text in the ticket's subject.
subject:"upgrade account"
description The text in all the ticket's comments.
description:defective
status New, Open, Pending, Solved, Closed.
status<closed
ticket_type Question, Incident, Problem, Task.
ticket_type:problem
priority Low, Normal, High, Urgent.
priority>low
group The assigned agent's group name.
group:"Level 2"
organization The name of the ticket requester's organization.
organization:customers
tags Tags that have been added to the ticket.
status:pending tags:premium
via The ticket's source, which can be any of the following:
  • mail (from an email message)
  • get_satisfaction, get_sat, "get satisfaction" (from Get Satisfaction)
  • dropbox (from the Zendesk Feedback Tab)
  • merge (from a ticket merge)
  • chat (from Chat)
  • twitter_dm, "twitter dm", "twitter direct" (from a Twitter direct message)
  • twitter_fav, twitter_favorite, "twitter favorite" (from a Twitter favorite)
  • twitter (from any Twitter method including direct message and favorite)
  • voicemail (from a voicemail message)
  • phone_call_inbound (from an inbound phone call)
  • phone (from voicemail or an inbound call)
  • sms, text, "text message" (from a text message)
  • logmein, logmein_rescue, "logmein rescue" (from LogMeIn)
via:phone
commenter People who have added comments to tickets.
commenter:"Mike"
You can search by a user's ID, a partial name, full name, and using an email address.
cc People who have been CC'd on tickets.
cc:amanda@mondocam.com
You can search by a user's ID, a partial name, full name, and using an email address.

All of the ticket property keywords can be used in search statements alone, in combination with other ticket property keywords, or with thetypekeyword (see Using the type keyword).

Searching ticket user roles

Users have various roles on tickets (requester, assignee, etc). These user roles can be searched by the user's ID, their name (partial or full), or their email address, as in these examples:

requester:52789480
submitter:amy
assignee:"amy moore"
requester:amy@mondocam.com

Notice that none of these searches required the ID, or name, or email to be explicitly declared. Each of these keywords accepts all of these user identifiers.

Searching for yourself

Themekeyword value allows you to search user properties in tickets where the value is your own user account (as the currently logged in user).

assignee:me
This works for all the user role properties in tickets:
  • requester:me
  • submitter:me
  • assignee:me

For information about searching for user profile data, see Searching users.

Searching custom ticket fields

You can search for a specific value in custom ticket fields by using the fieldvalue keyword. For example: 

fieldvalue:12345

This returns all the tickets that have a custom field with the value "12345."

If your custom field assigns a tag to the ticket, you can also search for custom ticket fields using the tags that you assigned to the custom field. For example, if you created a drop-down list, you can search for the tags assigned to each list box item.

To search for specific drop-down list selections, you use the tags keyword.

tags:product_question

This applies to the custom field formats that be assigned tags: the drop-down list and the checkbox. The checkbox custom field can include a tag to indicate that the user has clicked the checkbox.

All of the other custom fields (text, multi-line text, numeric, decimal, regular expression) can be searched by the text or number values submitted by ticket requesters. For example, if you added a numeric custom field to the support request form to collect demographic information such as age, you can search for the numbers that the requesters entered in the form (type:ticket "18").

Ordering and sorting ticket search results

Search results can be ordered and sorted using the order_by and sort keywords.

You need to use both of the keywords together in a search statement, as in this example:
status:new order_by:updated_at sort:asc

Here are the valid sorting and ordering keyword and value pairs that you can use:

  • sort:asc
  • sort:desc
  • order_by:priority
  • order_by:status
  • order_by:ticket_type
  • order_by:updated_at
  • order_by:created_at

All of the order_by and sort keyword/values pairs can be used when searching ticket data. 

 

Comments

User photo
Pat
nvelo

Great Help article.  I was able to extract everything I wanted with one exception.  I want to know how many tickets were merged so I can delete them from the total count.  It looks as if the operator I should be using is via:merge but when I use it in the following 

updated>2012-09-01 updated<2012-09-30 via:merge

I get zero results and I know there are merged tickets.  What is the proper syntax to get merged tickets in a date range.  Sweeter yet what is the syntax to get the number of unique tickets created for a month?  That is the end result I am trying to get to.

October 02, 2012 16:02
User photo
Carlos Garcia Valencia
senergyoilandgas

Would it be possible to have on the results the same properties available with the old API, which are not longer on the results of the new API? : status_updated_at, linked_id, assigned_at, solved_at, etc...

Regards 

November 08, 2012 02:20
User photo
Riley Withers
janrain

I found these two search queries very useful in the Lotus interface:

"foobar.com" order_by:created_at sort:desc 

"what ever you need" order_by:updated_at sort:desc

April 01, 2013 12:06
User photo
David Rieger
epicloansystems

i need to do a query by custom field which is a textbox, any ideas? I have sent tickets and email but I am just dissapointed by 3 days of silence.

June 26, 2013 10:15
User photo
Laura D.
Zendesk

Hi Drieger, 

Sorry about the delay - I checked and it looks like Advanced Support was able to get back to you with some suggestions. Just in case anyone else is interested here's what they suggested:

(This isn't quite what you're looking for but this might get you pretty close)

Our API search end-point respects the same syntax that the Search tool in Zendesk uses and nothing more. Unfortunately there is not a way with Zendesk search to search for the values of a particular custom field. If you are using a drop down field though, each value for the field corresponds to a particular tag so you can use tag search to return tickets with a particular option selected. Just find the tag linked to the field value and do a search for 

"tags:the_option_tag"

That said, we do have a method that will let you search for values in all custom fields while excluding content in the subject field, ticket comments, etc. This is useful if you are trying to search for a number or character string entered in a custom field.

To do this you just need to use syntax like the following:

fieldvalue:5095

That, in conjunction with other search terms, would limit the results to tickets that have '5095' entered into any of their custom fields.

June 27, 2013 16:32
User photo
Adam O'Brien
maintenanceconnection

Is there a way to search for records where a field value is null?

In my specific case, I am in the process of cleaning up our Requester list and we have 1,000+ Requesters that do not have an associated Orginization... it would be extremely handy to be able to use something like 'Organization: -' or something to that effect that would allow me to easily sort out my Requester list.

August 12, 2013 07:18
User photo
Laura D.
Zendesk

Hi Adam, 

Would a search with "organization:none" help? I found that in one of our other different search references. 

August 12, 2013 15:40
User photo
Angel Metayer
ffs

This is actually very complicated. Is this available in an easily accessible area in the ZD? 

August 30, 2013 10:11
User photo
Johannes Sidarta
revolutionitsupport

Hi Laura,

It would be nice to have ability to search for custom field (not drop down field) in ticket...

September 02, 2013 19:03
User photo
Laura D.
Zendesk

Hi Johannes, 

Just to understand a little better, you can do this (maybe not quite as easily as other options) as I mentioned above using the "fieldvalue:12345" (or with text), is there a different way you're looking for this to work?

September 03, 2013 14:04
User photo
Johannes Sidarta
revolutionitsupport

Hi Laura,

Thanks, I didn't read the whole trail of the comments.

It would be nice to add this additional detail to the original forum description. At the end I use fieldvalue:keyword_searched_value

 

September 03, 2013 15:51
User photo
Laura D.
Zendesk

That's a good point - I'll ask Documentation to add a note :) Thanks!

September 04, 2013 09:25
User photo
Jennifer Rowe
Zendesk

Thanks, Johannes and Laura. I added the "fieldvalue" keyword to the article.

September 11, 2013 15:13
User photo
Pete Rivett
adaptive

We have two separate custom fields: one for the release where a problem was found, the other for the release where it was fixed. Both have values such as 7.0.1956. How do we search for which tickets were fixed (as opposed to found) at a specific release? fieldvalue: finds those which were both fixed and found.

February 05, 2014 02:47
User photo
Ian LaPhilliph
Zendesk

Hi Pete,

Unfortunately there is not a way with Zendesk search to search for the values of a particular custom field. "Fieldvalue:" is going to pick up all custom fields that have 7.0.1956 entered.  As an alternative you could use a drop down menu rather then a text box as then you can search for the specific tag (using "tags:") that is left on ticket after a value is selected from the drop down menu.  

February 16, 2014 12:18
User photo
Andrew M

Wow - how brain dead is that, if you can't specify the custom field you want to search! It's also inconsistent with searching for users / organizations, where it is possible to specify the custom field. I trust this is getting some development attention to rectify?

February 19, 2014 12:46
User photo
Andrew M

We need to use custom fields to better integrate with our own application. To try and work round the fact that you can't search a specific field, I decided to include tags in the custom field. So I currently have 2 tickets with the same custom field value (";CCO=1;;CSO=2;;User=3;") - one ticket was created new with that value, and another ticket had the value added to it. This reveals the following problems:

1) If I do a search for fieldvalue:"CCO=1" then only the ticket that was created new with the custom field shows up in the search results. There should have been 2 tickets found

2) If I do a search for fieldvalue:"CCO=2" then I have the same results - but I would not expect any results, since that string does not occur within the field.

Please advise

 

 

February 19, 2014 13:52
User photo
Andrew Meyercord
rainier

Why is there no property keyword to search by Ticket ID? The guide says to just specify the ticket number as the search term with no property keyword, but then I have to filter for extraneous results that might get returned just because they happen to have that number in some other field.

March 06, 2014 12:21
User photo
Laura D.
Zendesk

Andrew M, 

Sorry for the delayed response.

Search overall is an area we're working on across the board - you bring up a good point though. I don't have access to all of the details for our roadmap for search but I will do my best to find out about custom fields. I did some test searches in your account and I'm not sure what's going on - why some results are showing when they don't appear to have the content listed in the search. I'm going to do some research and I'll either post here if there's an answer that makes sense to share or start a ticket for you. It may take a little time to get an answer so please hang on for another day or two. 

 

Andrew Meyercrod, 

Usually when I search for a ticket by typing in the number, almost as soon as I've finished typing it (before Zendesk can search) I hit enter and Zendesk opens a tab with that ticket. If I let Zendesk search with the number I'll get a bunch of results for tickets that include that number somewhere in the comments or fields. Even if the search results populate, if your cursor is still in the search field, hitting enter should take you to the ticket. Hope that helps a bit!

March 06, 2014 15:48
User photo
Andrew Meyercord
rainier

Thanks Laura, this advice will help when I'm searching from the web portal, but it doesn't help when I perform a search with the API. All of the irrelevant results that are returned when you let Zendesk complete the search are also returned when I perform an API search for a number. This requires me to write two searches to find a ticket by ID: one to get that big list of results that happen to include the number and then a second to step through the first list one-by one to find the ticket that actually has the ID number I'm looking for.

March 07, 2014 06:09
User photo
Andrew Meyercord
rainier

I think I found my answer. An API search for a ticket by ID can be performed using GET /api/v2/tickets/{id}.json or for multiple tickets, POST /api/v2/tickets/show_many.json?ids={ids}

March 07, 2014 06:35
User photo
Laura D.
Zendesk

Ah, I had not realized you were using the API - I'm glad you found what you needed though!

March 07, 2014 16:45
User photo
David Lim
vernier

I'm using the API trying to get a list of tickets that don't have a tag. I'm building a separate automation that goes through new tickets and checks it against a different database. After the ticket has been checked, I was thinking of tagging it so the automation can skip it the next time a batch of tickets is requested from Zendesk. Is there a negation parameter or a different way to solve this problem?

March 19, 2014 14:37
User photo
Bob Novak
Zendesk

Hi David - a negation parameter isn't going to work in this fashion for our API search. I think the best thing to do is make a View in your Zendesk that displays the tickets you want to process. This view can have a negative condition of [Ticket: tags][Contains none of the following][your_tag]. Then you can use the API (http://developer.zendesk.com/documentation/rest_api/views.html#getting-tickets-from-a-view) to get a list of tickets in the View, and have your external automation use that list for your batch. Please review the linked documentation carefully, as views that are called very frequently by an API client (more often than once every 5 minutes on average) may be cached by our software - so be aware of that if you will be doing this process frequently.

April 01, 2014 08:54