1

Ive created an Embedded Service Deployment to add the Live Chat to my pages. I am able to add the chat to the page. I am trying to prepopulate some of the fields, so that when I embed it into a production page I can pass in user information.

I have added the prepopulatedPrechatFields to my code snippet, but all of the fields remain blank of the page.

<apex:page>
<apex:includeLightning />
<script type='text/javascript' src='https://c.la1-c1cs-ia2.salesforceliveagent.com/content/g/js/47.0/deployment.js'></script>
<script type='text/javascript'>
    liveagent.init('https://d.la1-c1cs-ia2.salesforceliveagent.com/chat', '572R000000003Av', '00DR00000002bYE');
</script>
<script type='text/javascript'>
    var initESW = function (gslbBaseURL) {
        embedded_svc.settings.displayHelpButton = true;
        embedded_svc.settings.language = '';

        embedded_svc.settings.defaultMinimizedText = 'Contact Us';
        embedded_svc.settings.disabledMinimizedText = 'Contact Us';
        embedded_svc.settings.offlineSupportMinimizedText = 'Contact Us';

        embedded_svc.settings.prepopulatedPrechatFields =
            {
                Subject: 'prepopulatedPrechatFields',
                WebName: 'TestName',
                Type: 'Question'
            };

        embedded_svc.settings.enabledFeatures = ['LiveAgent'];
        embedded_svc.settings.entryFeature = 'LiveAgent';

        embedded_svc.init(
            'https://cs2.salesforce.com',
            'https://liveagent-andretest.cs2.force.com/dev',
            gslbBaseURL,
            '00DR00000002bYE',
            'Client_Live_Chat',
            {
                baseLiveAgentContentURL: 'https://c.la1-c1cs-ia2.salesforceliveagent.com/content',
                deploymentId: '572R000000003Aq',
                buttonId: '573R000000003Lt',
                baseLiveAgentURL: 'https://d.la1-c1cs-ia2.salesforceliveagent.com/chat',
                eswLiveAgentDevName: 'EmbeddedServiceLiveAgent_Parent04IR00000004CJQMA2_16d249174a0',
                isOfflineSupportEnabled: true
            }
        );
    };

    if (!window.embedded_svc) {
        var s = document.createElement('script');
        s.setAttribute('src', 'https://cs2.salesforce.com/embeddedservice/5.0/esw.min.js');
        s.onload = function () {
            initESW(null);
        };
        document.body.appendChild(s);
    } else {
        initESW('https://service.force.com');
    }
</script>

3

0

You must log in to answer this question.

Browse other questions tagged .