I' looking to redirect my logged in users to the home page instead of the ticket detail after submit a new request. I tried the following but didn't work out:
Hi Carlos! I threw something together for this which should work for you. I didn't test this for many scenarios, so use this as an example and test it out to see if it works for you! You'll want to place this in your document_head.hbs:
<script> let ticketNumber = window.location.href.split('requests/').pop(); let ref = document.referrer
if (ref.match('https://yoursubdomain.zendesk.com/hc/yourlocale/requests/new') && ticketNumber.match(/^[0-9.]+$/)) {
It's not pretty at all, but it should get the job done. This will run whenever the url slug contains only a number, so it won't get caught by the ticket form id search value. Also, remember to replace "yoursubdomain" with your actual subdomain. If you use host-mapping, update the above snippet accordingly.
If you run into any issues with this, let me know!
Hi Greg ! thanks for the information. However, I'm not trying to not enter the new request page, instead I'm trying to redirect after the user submits a new request. So they should be able to fill the form and send it but immediately redirected to the home page. Does this make sense?