Pre-populate ticket submission form field via query string (Help Center)

58 Comments

  • Greg Sohl
    Comment actions Permalink

    Hello, Zendesk? We all understand there's only so much development time to go around, but this should be 101 stuff.

    The courtesy of a reply would be appreciated.

    Greg

    4
  • Harrison Dimon
    Comment actions Permalink

    Can't stress enough how important this is to so many people for so many reasons. Please prioritize

    4
  • Vinay Gupta
    Comment actions Permalink

    In my opinion this is one functionality which is very critical for me because it relates to the effort which my customers need to make to report their issues. Pre-populating the fields makes it immensely effective and ensures that they find it a quick and fruitful experience.

     

    Can we expect this feature being implemented in near future?

     

    Thanks

    3
  • Aaron U'Ren
    Comment actions Permalink

    We would also like this feature. This is a feature that was implemented for the previous interface, but now, as the thread Tom pointed out mentions, this no longer works with the new ZenDesk interface. This is really useful to our business as we have an application that already has most of the information needed for the ticket submission form available to it. Our support agents use this application as a first lookup to verify user identity and other information. However, when it comes time to making a ticket, they then have to go to ZenDesk and enter all of the same information over again. It would be very helpful to be able to craft a URL that would set the information on the ticket that our support agent has already looked up.

     

    This feature was deemed important enough to add to the last interface, I think that it deserves to be brought back in the new interface.

    3
  • Sergio Negri
    Comment actions Permalink

    @Nicole this solves the problem of parsing the URL, not how to properly set those data in the form. Or am I missing something?

    3
  • Gtagliabue
    Comment actions Permalink

    Can't believe this was open in 2013. Can this please get some real attention?

    3
  • Tim Herby
    Comment actions Permalink

    @Nicole, do you have an update from the product team?  We could critically use this to capture some simple information about our customers that we already have in-product, rather than making them type it in again in the helpdesk.  This means we have a huge loss of information when people click over to the help form.  If we could simply capture the UserID reliably, that would be huge.

    Your customers have been asking for this feature for 5 years, and it's a simple feature, just capturing values and pre-filing one form.  As the CTO of a software company, I know you have many competing priorities, but I also know this is a simple change.  I implore you to consider the small size of this feature and the obvious customer demand as evidenced in this thread.

    3
  • Mantas K
    Comment actions Permalink

    Totally agree. We would like to include a Zendesk link into our CRM with default values for a ticket. Then the agent would be able to further complete the ticket. With API you cannot create a draft ticket.

    2
  • Jon Hughes
    Comment actions Permalink

    This is a great idea and definitely needed ASAP.

    2
  • Bram Gooris
    Comment actions Permalink

    +1 We need this aswell! 

    2
  • Matt Farrington Smith
    Comment actions Permalink

    This would be welcomed - can't believe it doesn't exist already.

    Can we get an official word on it?

    Matt

    2
  • Jose Cerna
    Comment actions Permalink

    I agree this would help my users so much, I can't see javascript example. that Joe wrote because I don't have access. Can you repost or set it to public again?

    2
  • Justin
    Comment actions Permalink

    Any update on this request?

    2
  • Tim Herby
    Comment actions Permalink

    Jira has this feature for filing bugs and tickets. https://confluence.atlassian.com/jirakb/creating-issues-via-direct-html-links-159474.html

    It's very standard part of how the web works (link to a form and pre-fill information), and your customers have been asking for 5 years.  The lack of response to this ticket, and continued inability to take it seriously is one of the reasons we are looking to leave Zendesk.

    2
  • Matt McLean
    Comment actions Permalink

    Here's the code I added to our "new_request_page.hbs" to get this functionality:

    <script>
    (function ($) {
    var aliases = {
    //this section is optional. the integers for your custom
    //fields can be found by going to the edit page for each field

    //'user_friendly_custom_field_name1': 'custom_field_id_(integer1)'
    //'user_friendly_custom_field_name2': 'custom_field_id_(integer2)'
    }
    var parsedQueryString = function () {
    var segments = window.location.search.substr(1).replace(/\+/g, ' ').split('&'),
    parsed = {};
    if (!segments) return parsed;
    for (var i = 0, count = segments.length; i < count; i++) {
    var parts = segments[i].split('='),
    key = parts.shift(),
    value = parts.length ? decodeURIComponent(parts.join('=')) : null;
    parsed[key] = value;
    }
    return parsed;
    }
    $(document).ready(function () {
    var query = parsedQueryString();
    for (var key in query) {
    if (!query.hasOwnProperty(key) || key == 'ticket_form_id') continue;
    var prefix = '#request_',
    value = query[key];
    if (typeof aliases[key] !== 'undefined') {
    key = aliases[key];
    }
    if (key == 'email') {
    prefix += 'anonymous_requester_';
    } else if (/^\d+$/.test(key)) {
    prefix += 'custom_fields_';
    }
    var field = $(prefix + key),
    data = field.attr('data-tagger');
    if (data) {
    data = JSON.parse(data);
    var label = '';
    if (!value) {
    label = data[0].label;
    } else {
    for (var i = 0, count; i < data.length; i++) {
    if (data[i].value == value) {
    label = data[i].label;
    break;
    }
    }
    }
    field.val(value).closest('.nesty-input').text(label);
    } else {
    field.val(value);
    }
    }
    })
    })(jQuery)
    </script>

    All of the above code was lifted from the old pre-populate the new ticket form ? – Zendesk Support comments page which seems to have gotten removed. A version of the above code was originally shared by Ian Beck -- see https://gist.github.com/onecrayon/a1e5d3d30b737856dde1b193205b1c95

    I added the above script to one of my help centers almost 2 years ago (Copenhagen theme) and it has continued to serve me well.
    You can pre-fill the 'description' field by simply using:

     &descripton=Your+string+goes+here 

    You can pre-fill any custom fields by either using their identifier integer in the URL, or if you use the optional "aliases" section, you can use a friendly human-readable name for each custom id.. for example, we were using it in location-based kiosks to auto-populate the "location" dropdown menu (which corresponds to a tag):

    https://subdomain.zendesk.com/hc/en-us/requests/new?ticket_form_id=1000&description=Foo+bar&location=location_usa

    (Obviously you'd have to change your subdomain, locale, and your ticket form id for it to work. If you are trying to pre-populate dropdown fields, the "tag" that you put in for your custom field needs to be valid.)

    Thanks again to Ian Beck for this code!

    2
  • Gonzalo
    Comment actions Permalink

    I can't believe yo can't pre-populate a form using url params in Zendesk ... 6 years old this request and not sorted yet. Just gives you an idea on how responsive is this product to business demands. Shameful.

    2
  • Alexis Fabre Ringborg
    Comment actions Permalink

    +1

    We were also using this feature previously and it is not working anymore, so this is a loss for us

    1
  • Alexis Fabre Ringborg
    Comment actions Permalink

    Hello

    +1

    1
  • Sander Nelen
    Comment actions Permalink

    +1 ASAP please

    1
  • Simon N
    Comment actions Permalink

    +1, we really would benefit from this!

    1
  • Stijn
    Comment actions Permalink

    +1, please see ticket #1005373 that I've raised about this.

    An easy integration with this is so much more preferable then;

    • looking up of the user exists, through the API;
    • create the user if he doesn't, through the API;
    • create and pre populate the ticket through the API;
    • redirect the user to the correct place afterwards.

    Especially when you're doing a non-complex integration with Zendesk like replacing a "mailto" functionality.

    Here's how we do this with the current URL structure on the "old" forms;

    https://<domain>.zendesk.com/tickets/new?ticket[requester]=stijn@somedomain.com

    1
  • Tom H.
    Comment actions Permalink

    Unfortunately the Javascript code in the thread that Joe linked to doesn't seem to work anymore. Added it to my New Request form, but the parameters are ignored. Too bad, I'd also really like this feature. 

    1
  • Greg Sohl
    Comment actions Permalink

    I tried what &y wrote for signed-in agents. It did not work for me.

    https://xxx.zendesk.com/hc/en-us/requests/new?request[subject]=Check+This+Out

    Did I get that right??

    1
  • Tim Herby
    Comment actions Permalink

    Doesn't work for me.  Is this still not possible after 4 years?

    Can someone from Zendesk reply tot his?

    1
  • Nicole - Community Manager
    Comment actions Permalink

    Hey all - 

    I've added this to my list of questions for Product. In the meantime, Jose, see if this JS works for you:  

    (Copied and pasted from a comment made by Community member PaulAlexander on 4/4/10 that lives in a now-archived thread) 

    location.href.replace(

    new RegExp("([^?=&]+)(=([^&]*))?", "g"),

    function($0, $1, $2, $3) {

    var f = $($1);

    if( f ) f.value = unescape($3);

    }

    );

    location.href.replace( new RegExp("([^?=&]+)(=([^&]*))?", "g"), function($0, $1, $2, $3) { var f = $($1); if( f ) f.value = unescape($3); });

    It can be placed in any custom widget or even a global script.

    1
  • Tom Wilson
    Comment actions Permalink

    This is possible.

     

    Zendesk does this when you create a ticket from your own Zendesk, they fill out the data such as your sub-domain.

    So Zendesk does have a way of doing this - let us customers use it!

    1
  • HelpBetter
    Comment actions Permalink

    I came to this post looking for a solution as well. I was able to add this by including the following script in my global help center .js file:

    prepopulateSupportTicket ();

    function prepopulateSupportTicket ()
    {
       var params = getQueryParams (document.location.search);
       if (params.subject) $("#request_subject").val (params.subject);
       if (params.body) $("#request_description").val (params.body);
    }

    function getQueryParams (queryString)
    {
       queryString = queryString.split ('+').join (' ');

       var params = {};
       var tokens;
       var regex = /[?&]?([^=]+)=([^&]*)/g;

       while (tokens = regex.exec (queryString))
       {
          params[decodeURIComponent (tokens[1])] = decodeURIComponent (tokens[2]);
       }

       return params;
    }

     

    Hope this helps someone.

    1
  • Justin
    Comment actions Permalink

    ^ @HelpBetter, that didn't work for me. Do I need to add a rule for a specific form ID?

    1
  • Matt Owens
    Comment actions Permalink

    Hey Team, 

    Wanted to include a use case for this feature as our team would also benefit URL parameters to pre-fill. 

    Use Case: QR Code Scans

    User has an application that includes a QR reader included. User is working on a project with several similar pieces of hardware, and possibly multiple locations. Each piece of equipment has a QR code that holds a pre-filled URL that includes location, equipment type, and the project to which it was loaned. When the user has an issue with a piece of hardware, they scan the code, and complete minimal steps. Submits with values pre-filled. 

    Current Workflow: User would hit a form for equipment, would select the project (if belonging to multiple), equipment type (even types not applicable), and location. Submits with possibly incorrect information. 

     

    The ability to create URL specific submission forms would allow to give a direct entry based on known factors. 

    Best,

    Matt Owens

    1
  • Deanna
    Comment actions Permalink

    Our team would also benefit from pre-filled custom fields. We are using javascript currently but it doesn't work in all situations:

    Javascript is not supported on all browsers (we are having issues with some older Android browsers and the Playstation 4 game browser)

    Zendesk's custom drop-down fields do not seem to be able to be prefilled with javascript on Safari for iOS. Using the val() function will set a value on the drop-down field but it will not update the look of the field. The drop down box will appear empty to the user.

    We've spent a lot of time trying to resolve platform-specific issues due to lack of support for this feature. Please consider adding this feature as we would like to be able to provide consistent support for prefilled fields across all our platforms.

    1

Please sign in to leave a comment.

Powered by Zendesk