Recent searches


No recent searches

Help Center Search By Ticket ID



Posted Mar 07, 2018

When searching in the the help center for a ticket number, the search results do not include tickets. I came up with a quick way to redirect them on a search. It basically checks a failed search result to see if its a number and if it is, tries to redirect it to a ticket link.

 

*Requires jQuery

Edit the search_results.hbs file

Locate the placeholder for no search results: section should have something like {{t 'no_results' query=query}}

Paste in the following code

<script type="text/javascript">
$(document).ready(function(){
var searchQuery = $('.page-header-description').html().replace('No results for "', '').replace('"', '');
if($.isNumeric( searchQuery ))
{
window.location = '/hc/en-us/requests/' + searchQuery;
}
});
</script>


0

7

7 comments

image avatar

Jessie Schutz

Zendesk Customer Care

Thanks for contributing, Andrew!

0


Works well thank you,

Note to others, takes into account user access so will only allow the viewing of tickets either logged in the name of the current logged in user or those that user is CC'd into to. otherwise it fails over to the oops the page you were looking for doesn't exist.

Thanks

Andrew

The page you were looking for doesn't exist – Support Portal

 

 

0


image avatar

Jessie Schutz

Zendesk Customer Care

Thanks for pointing that out, Andrew!

0


Thank you Andrew and Andrew!

Though I am not completely versed in code or even consider myself a developer,  I greatly appreciate these types of examples as they give me the chance to learn by build off of them and create a script based on our teams needs.

I believe my team will end up offering a link to the /hc/en-us/requests page when a customer searches a numeric value with no results rather than redirect the customer to the ticket request link. Mainly due to the customer experience and to avoid the error page, should they enter the wrong ticket ID or not have access to the ticket.

There may be a few ways to do this but I ended up replacing line code:

window.location = '/hc/en-us/requests/' + searchQuery;

with the following:

 

$( "p" ).append("<br><br> <strong>Looking for a Zendesk Request? Access all your requests here: </strong>").append('<div> <a href="https://YOURDOMAINHERE.zendesk.com/hc/en-us/requests">My Requests</a> </div>');
}

 

Here is what the search results section would look like if searching 12333 with no results, where it now offers a link to the my requests page:

 

You would have the flexibility to add text/html to your teams needs, especially if you are using custom html.

All credits to Andrew here! Thanks!

 

0


image avatar

Jessie Schutz

Zendesk Customer Care

Hey Socorro!

This is really fantastic! If you're interested, it would be great if you could write this up as an official Tip here in Tips & Tricks. We even have guidelines for writing great tips, in case you're not sure where to start. There could be swag in it for you, too. :)

0


Is this still the best workaround to solve for when ticket numbers are being searched? 
** I know this is from three years ago and just want to be sure there isn't a better way? 

0


Hi Erin,

The above workaround is still the best way to allow search for ticket IDs in your help center.

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post