0

After customer registers his case and automated email is sent to him. In this email there should be an hyperlink - which initiates the live chat with available agent. From agent side- when he accepts the chat- he needs to get the existing case record window on his screen. This is the requirement. I'm trying to put the button and deployment code in the HTML email Template. But it is not working. Someone please help me to resolve this issue.

Below is the code that I'm trying to use in the email template.

<!-- Button Code -->
<a id="liveagent_button_online_582f000000000RK" href="javascript://Chat" style="display: none;" onclick="liveagent.startChat('582f000000000RK')" > CLick Here</a> 
<div id="liveagent_button_offline_582f000000000RK" style="display: none;"> Sorry No Agent Available </div>
<script type="text/javascript">
if (!window._laq) { window._laq = []; } 
 window._laq.push(function(){liveagent.showWhenOnline('582f000000000RK', document.getElementById('liveagent_button_online_582f000000000RK'));
 liveagent.showWhenOffline('582f000000000RK', document.getElementById('liveagent_button_offline_582f000000000RK'));})
</script>


<-- Deployment Code -->
<script type='text/javascript' src='https://c.la4-c8ch-iad.salesforceliveagent.com/content/g/js/40.0/deployment.js'></script>
<script type='text/javascript'>

<!-- liveagent.addCustomDetail('Case Number', '00001006');  -->

liveagent.addCustomDetail('Case Number', '{!Case.caseNumber}'); 

liveagent.findOrCreate('Case').map('CaseNumber','Case Number',true,true,true).saveToTranscript('CaseId').showOnCreate();

liveagent.init('https://d.la4-c8ch-iad.salesforceliveagent.com/chat', '582c0000000Cpya', '00Dk0000009w6Y7');

</script>
1
  • what exact issue you are facing? What is not working? Aug 21, 2017 at 4:55

1 Answer 1

1

I tried a few instances of HTML templates and Visualforce templates to put code in email itself. Couldn't get them to work though.

The better way here would be to create a VF page and send case number as a parameter into the page when invoked.

In your template you can put in the email content + the link of VF page with case number parameter.

This link should be publicly accessible to the recipient. So you have to use a Site. Add VF page you created to the site.

The VF page should contain the live chat content that you have pasted above.

So when a recipient gets the mail, he reads the email content and if he clicks the link to chat(which is a vf page), we migrate to the page and run live agent script and invoke a chat.

If you don't want to put a button on the VF page once again you can make use of startchat method directly in the Javascript and remove button reference

2
  • Yesterday, I did same by passing parameters in a VF page and it worked. I forget to update here. Thank You So Much Wilson for helping me.
    – S R
    Aug 22, 2017 at 20:07
  • Cool! Way to go S R.
    – Wilson
    Aug 22, 2017 at 20:18

You must log in to answer this question.

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