I am trying to pass value from HTML page(place where button code and deployment code is placed) to prechat form using

`liveagent.addCustomDetail('test','Test Value')`

process. but when I try to get that the value from Prechat form form using

<script type='text/javascript' src='https://c.la1c1.salesforceliveagent.com/content/g/js/32.0/prechat.js'></script>
<script type="text/javascript">
var detailCallback = function (details){
    for (var i = 0; i < details.customDetails.length; i++) {
        if(details.customDetails[i].label == 'test'){


it gives me an error

Uncaught TypeError: Cannot read property 'preChatInit' of undefined

Please tell me where I am going wrong or is there any other way of passing the data.



After some troubleshooting (see comments to question) it appears that the issue was that the wrong version of the script was being used (was trying to use version 42 which does not exist at this time). By switching to version 32, the error went away.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.