0

We have a Chat link that resides on our public website. We need to now have the customer opt in and agree to our Privacy policy before they can initiate the chat. So we created a webpage where the customer can review the Privacy policy. and if they agree to it, the chat window will be initiated. I need to capture a value that states that the customer agreed to the Privacy Policy. So I was wondering, can I add the value to Live Agent Deployment Code.

<script type='text/javascript' src='https://c.la9-c1cs-phx.salesforceliveagent.com/content
/g/js/46.0/deployment.js'></script>
<script type='text/javascript'>
liveagent.addCustomDetail('OptIn', '{True}').saveToTranscript('OptIn__c'); 
liveagent.init('https://d.la4-c1cs-phx.salesforceliveagent.com/chat', '1111111111111111', '0000000000000000');
</script>

If the customer opts in the value will be set to True. I need this value to be reflected on the Chat Transcript record. Will the approach above work?

I just found the JS code on the actual webpage.

 liveagent.addCustomDetail('CaseOrigin', 'Chat');
    liveagent.addCustomDetail('CaseSubject', 'Chat');
    liveagent.findOrCreate("Case").map("Origin", "CaseOrigin", false, false, true);
    liveagent.findOrCreate("Case").map("Subject", "CaseSubject", false, false, true);

    liveagent.findOrCreate("Case").showOnCreate();
    liveagent.findOrCreate("Case").saveToTranscript("CaseId");

To add the new custom field on the Transcript record would I change the JS to look like this:

 liveagent.addCustomDetail('CaseOrigin', 'Chat');
    liveagent.addCustomDetail('CaseSubject', 'Chat');
    liveagent.findOrCreate("Case").map("Origin", "CaseOrigin", false, false, true);
    liveagent.findOrCreate("Case").map("Subject", "CaseSubject", false, false, true);


    liveagent.findOrCreate("Case").showOnCreate();
    liveagent.addCustomDetail('PrivacyPolicy', 'True').saveToTranscript('Privacy_Policy__c');
    liveagent.findOrCreate("Case").saveToTranscript("CaseId");

Thanks

2
  • Ok. Just inspected the code on the actual web page and found the JS code that creates the Case and Transcript record. – Mike Jun 5 '19 at 15:36
  • Privacy_Policy__c field is a checkbox – Mike Jun 5 '19 at 15:53

Your Answer

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

Browse other questions tagged or ask your own question.