3

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'){
            console.log(details.customDetails[i].value);
        }
    }
};

liveagent.details.preChatInit('https://d.la1c1.salesforceliveagent.com/chat','detailCallback');

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.

Thanks!

0

1 Answer 1

2

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .