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.

×