Recent searches


No recent searches

Editing a form's URL

Answered


Posted May 11, 2023

How can I edit the URL of one of my forms? It would be nice to edit the whole URL, but ultimately I just need to add a word to the end of the URL.

Current:  https://___.zendesk.com/hc/en-us/requests/new?ticket_form_id=#######

Needed:  https://___.zendesk.com/hc/en-us/requests/new?ticket_form_id=#######_newword


0

8

8 comments

image avatar

Ifra Saqlain

Zendesk LuminaryMost Engaged Community Member - 2022Most Engaged Community Member of The Year - 2021Community Moderator

Hi Amy :)

Add this code at the bottom of script.js file:

  document.querySelector("option[data-url='https://xyz.zendesk.com/hc/en-us/requests/new?ticket_form_id=#######']").setAttribute("data-url", "google.com");

 

Note: Remove google.com

from the code 

setAttribute("data-url", "google.com");

and add your URL which you want like this

https://xyz.zendesk.com/hc/en-us/requests/new?ticket_form_id=#######__newword

 

 

Remove this URL 

https://xyz.zendesk.com/hc/en-us/requests/new?ticket_form_id=#######

From the code 

("option[data-url='https://xyz.zendesk.com/hc/en-us/requests/new?ticket_form_id=#######']")

and add your form URL which you wanna update

 

Thanks

 

0


Hi Ifra,

Thanks so much for the quick reply. I did this, but that URL now takes me to the "Submit a request" screen with the dropdown to select which form to fill out. Even when I click on the form with the edited URL, I am looped back to this page and cannot fill out the form. Is there a way for the URL to go directly to the form itself?

0


image avatar

Ifra Saqlain

Zendesk LuminaryMost Engaged Community Member - 2022Most Engaged Community Member of The Year - 2021Community Moderator

I know because you can't edit the original URL which comes from backend. If you edit the original url it will create bug. You asked that's why I shared the trick.

0


If I understand this correctly, you're saying it's possible to change the original URL with the code you initially provided, but it introduces a bug and there is no fix for the bug. So this would not be a workable solution. 

0


image avatar

Ifra Saqlain

Zendesk LuminaryMost Engaged Community Member - 2022Most Engaged Community Member of The Year - 2021Community Moderator

@Amy Giella, actually the URLs in the helpcenter come from backend I means URLs defined by the developers, On my behalf you can't change the default URLs.

0


Amy Giella hello, 
I have had the same need this week to modify the URL for UX issues, I did it with the following script:

  (function cambiarUrl() {
    if(document.URL.indexOf("#########") != -1) {  //modify the ID of your form #####.
        const state = { 'user': 'guest' }
        const title = ''
        const url = 'https://xyz.zendesk.com/hc/en-us/requests/new?ticket_form_id=#######__newword' // write here the url that you want to be seen.
         
        history.replaceState(state, title, url);
        }
            
})
 
();  

Since we are modifying the user's browsing history, you must take into account that this is not an existing URL, so if the user tries to search for it directly, he will get an error not found, so I suggest you handle this error.

I hope my idea helps you.

1


Thanks so much, Sebastian! This got us a step closer to where we need to be.

1


image avatar

Ifra Saqlain

Zendesk LuminaryMost Engaged Community Member - 2022Most Engaged Community Member of The Year - 2021Community Moderator

Thanks for sharing the trick @Sebastian :)

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post