2

I have a pre chat form and the app is configured to open a VF page when the chat request is accepted. I want to pass parameters entered in the pre chat form to this VF page. Thanks for your help in advance.

1

You have to use getDetailsByPrimaryTabId() method available in Salesforce Console Integration Toolkit. This will return the details of the chat associated with a specific primary tab ID. See this Salesforce documentation for more details.

Example VF page provided in the above mentioned link.

<apex:page >
    <apex:includeScript value="/support/console/29.0/integration.js"/>
    <a href="#" onClick="testGetDetailsByPrimaryTabId();">Get Chat Details</a> 

    <script type="text/javascript">

        function testGetDetailsByPrimaryTabId() {
            //Get the value for 'myPrimaryTabId'from the getPrimaryTabIds() or getEnclosingPrimaryTabId() methods. 
            //These values are for example purposes only
            var primaryTabId = 'myPrimaryTabId';
            sforce.console.chat.getDetailsByPrimaryTabId(primaryTabId, getDetailsSuccess);
        }

        function getDetailsSuccess(result) {
            //Report whether accepting the chat was succesful
            if (result.success == true) {
                console.log(result);
                chatKey = result.details.chatKey;
                alert('The chatKey for this chat is: ' + chatKey);
            } else {
                alert('Getting the details was not Succesful');
            }
        };

    </script>
</apex:page>

You can get all the pre-chat form details from the result JS object as below.

result.details.customDetails[0].value
result.details.customDetails[1].value
result.details.customDetails[2].value
...........
...........

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.