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

56 Comments

  • David da Silva Rosa
    Comment actions Permalink

    ^ @Nicole

    The proposed solution is not useful to me as I'd like to pre-populate other info than user info:

    1. User clicks on a button in our app.
    2. Logs file gets exported to a private server, which returns a unique logs ID.
    3. Contact form gets opened in web browser, the unique logs ID needs to be pre-populated so we know which logs belong to this ticket for our developers.

    If we could do this simply by matching a field ID with the desired content in the URL, that would be much appreciated. From the prior feedback, it seems there is significant demand for this. 

     

    0
  • Robert
    Comment actions Permalink

    I would love the ability to use URL variables to bring over client information

     

    I just want to pre-populate the subject with Client_ID.

    0
  • Grant Schenck
    Comment actions Permalink

    This is crazy.  Salesforce, NetSuite, Dynamics, etc. ALL support URL query parms for setting form fields.

    Why is this so hard to add/support?

    0
  • 木嶋 諄
    Comment actions Permalink

    what is the best way to do it?

    every way which has been posted here doesn't works?

    0
  • Jennifer Grill
    Comment actions Permalink

    Any solution to this? I would like to add a pre-populated subject in the url. 

    0
  • Jesper Grann Laursen
    Comment actions Permalink

    I also have this feature request - please fix this 6 years old request

    0
  • Nicole - Community Manager
    Comment actions Permalink

    Hey Jesper - 

    Just because something is posted doesn't guarantee it will get built, and longevity of a request is not one of the primary data points we use to prioritize developments. 

    I will ping the Guide team to see if this is something that they have considered or may be considering in the near future. If you have additional details about the problems you're trying to solve or the scope of the business impact, those sorts of things are most influential when the teams are taking customer feedback into account. 

    -4
  • Ignacio De La Llave Lorenzo
    Comment actions Permalink

    +1 very useful in multiple scenarios

    0
  • 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
  • Greg Sohl
    Comment actions Permalink

    @TimHerby, they long treated user questions on Sub-Categories the same way. With their latest announcements, I surmise they have been putting most of their resources into developing other products instead of bringing ZenDesk (support platform) forward.

    0
  • 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
  • Sorcha Millican-Nagle
    Comment actions Permalink

    This would be fantastic! Javascript is not supported in all browsers for our game and I can see this being applicable for both games and mobile apps.

    0
  • Tim Nguyen
    Comment actions Permalink

    I would like to insert code to auto populate a certain field upon a New Request, but can I do this if we have a "Team" license? 

    0
  • 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
  • Matt McLean
    Comment actions Permalink

    One warning about the code I posted above - as noted on Github, it doesn't work properly on Mobile browsers.

    However, it definitely works on desktop browsers, both Windows and Mac.

    1
  • Tim Nguyen
    Comment actions Permalink

    Hi Matt,

    would I be able to apply the code if my company's has Team edition of Zendesk?

    thanks,

    Tim

     

    0
  • Matt McLean
    Comment actions Permalink

    Tim Nguyen,

    Unfortunately, I think the "Team" edition of Support only comes with "Lite" Guide, which does not seem to allow custom themes & integrations, for which you would need to have a Professional or higher level Guide plan, according to this page:
    https://www.zendesk.com/product/pricing/?variant=a#guide_pricing

    I would just like to echo what Tim Herby said above:
    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.

    It's very disappointing to me that:
    a)custom code is required at all
    b)every customer that wants this feature needs to add the code themselves, and it's unsupported
    c)it doesn't work on mobile
    d)some customers aren't even able to use this custom code workaround, since only certain plans have the ability to customize the help center.

     

    1
  • Anders Vännman
    Comment actions Permalink

    Hi,

    Im trying out this excelent code, it works great for text fields. but it seems like im having some kind of issue with fields that are drop down. When i pass an field that are multiselect the field dissapears, for example:

    i include two screenshots, one before adding "&custom_fields_30020956093=val1" to the request string, and one when i had.

     

     

     

     

     

    0
  • Matt McLean
    Comment actions Permalink

    Anders,

    If you are using Ian Beck's code that I pasted above, the easiest way to do this would be to modify the "aliases" section first:

    var aliases = {
    //this section is optional. the integers for your custom
    //fields can be found by going to the edit page for each field
    'rutan': '30020956093'
    }

    Then, in your URL, make sure you use the tag that corresponds to val1 or val2.

    e.g. if your tag is val1_tag, do this:

    &rutan=val1_tag
    0
  • Matt McLean
    Comment actions Permalink

    Anders,

    It also seems you are using a multi-select dropdown menu.
    That could be part of the problem.
    See if you can get it to work with a "standard" drop-down menu first. The syntax for multi-select fields may be different or may not work at all.

    0
  • Anders Vännman
    Comment actions Permalink

    Hi, yes that’s right, I’m using multi select; when I’m using this script on regular text or combo box it works just fine.

    So good that we are considering restructuring our workflow a bit; if I can’t find a way for it to work with multiple select boxes.

    I’ve tried to do some digging in chrome but really, I’m to unfamiliar with html/documents all this so I really can’t figure it out. But it seems like how multiple selects are handled are very diffeeent.

    0
  • Andrew Soderberg
    Comment actions Permalink

    Matt wrote: "One warning about the code I posted above - as noted on Github, it doesn't work properly on Mobile browsers."

    I have just found and implemented Matt's re-discovery of Ian Beck's script. It works perfectly for our needs.

    I have tested it with iPhone Safari, and I have had no issues with it, the fields are pre-populated as expected. 

    I am using iOS 12.3.1. Note that I have not yet tested this on an Android device.

    0
  • Matt McLean
    Comment actions Permalink

    Andrew,

    You're right!

    I don't know when it started working on MobileSafari, but I just tested it and it worked.

    It's still true that this is an unsupported hack, YMMV, etc. etc.

    0
  • Harrison Dimon
    Comment actions Permalink

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

    1
  • Anders Vännman
    Comment actions Permalink

    I agree totally!

    For an example

    We are in a process where we want to use a HR-managment system for onboarding, the company that develops that solution are prepared to forward some of the process to our Zendesk with a query string for completion of some IT-specific fields that arent available in the HR-system (and shouldnt be managed there).

    But it cant really be done out of the box... 

     

     

    0

Please sign in to leave a comment.

Powered by Zendesk