Home > Technical Support > Tips & Tricks > How to automatically set a message into submit ticket form on customer portal from URL parameter

How to automatically set a message into submit ticket form on customer portal from URL parameter

If you want to pre-fill name, email and even message on your 'submit ticket' form on customer portal, you can use a link like this >>>

https://ACCOUNT.ladesk.com/submit_ticket?name=Customer&email=customer@email.com&message=Example%20text

Name and email work by default, but message field does not. So, if you really need to pre-fill also message from some reason, you can make a workaround and use JavaScript code inserted in customer portal which set also a message from URL.

In agent panel navigate to customer portal > settings > customize design > tracking codes > before </BODY>
and place this script into that field >>>

<script>
    function getParameterByName(name, url) {
        if (!url) url = window.location.href;
        name = name.replace(/[\[\]]/g, "\\$&");
        var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
        results = regex.exec(url);
            if (!results) return null;
            if (!results[2]) return '';
            return decodeURIComponent(results[2].replace(/\+/g, " "));
        }
    document.getElementsByName('message')[0].value = getParameterByName("message", window.location.href);
</script>

When you do that, text from 'message' URL parameter will be set into 'submit ticket' form. Please check the screenshot. 

Ready to try LiveAgent?

It's free for the first 14 days! No credit card required.

Get Started
We work well with others...
Magento Joomla Wordpress Mailchimp
Contact us

support@ladesk.com

+1-800-811-6590 (Toll Free in USA & Canada)

+421 2 33 456 826 (European Union & Worldwide)

Quality Unit, LLC 616 Corporate Way, Suite 2-3278 Valley Cottage, NY 10989

Stay in touch
Blog Google+
© 2004-2015 QualityUnit.com, All rights reserved