function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Wolfgang FernandesWolfgang Fernandes 

Live Agent - Salesforce

I need help regarding Live Agent. There is some delay when saving information on Live Chat Transcript object ?
I'm saving some information to close the chat and even then I'm not having a correct answer. Sometimes saves sometimes not . 
 
pconpcon
There should not be any delay when saving the transcript object.  How are you closing the chat?  If you monitor the debug logs do you see any errors when saving your transcripts?  Do you have a post chat page?  What information are you saving to close the chat?
pconpcon
There should not be any delay when saving the transcript object.  How are you closing the chat?  If you monitor the debug logs do you see any errors when saving your transcripts?  Do you have a post chat page?  What information are you saving to close the chat?
Wolfgang FernandesWolfgang Fernandes
Code to prechat Botao that calls Visualforce spending two parameters.:
<apex:page standardController="LiveChatTranscript" showHeader="false"> 

<img id="liveagent_button_online_573e000000000PG" style="display: none; border: 0px none; cursor: pointer" onclick="liveagent.startChat('573e000000000PG')" src="URL IMAGE" /><img id="liveagent_button_offline_573e000000000PG" style="display: none; border: 0px none; " src="URL IMAGE" />
<script type="text/javascript">
if (!window._laq) { window._laq = []; }
window._laq.push(function(){liveagent.showWhenOnline('573e000000000PG', document.getElementById('liveagent_button_online_573e000000000PG'));
liveagent.showWhenOffline('573e000000000PG', document.getElementById('liveagent_button_offline_573e000000000PG'));
});</script>

<script type='text/javascript' src='https://c.la2c1cs.salesforceliveagent.com/content/g/js/35.0/deployment.js'></script>
<script type='text/javascript'>
liveagent.addCustomDetail('wolf', 'antonio@accenture.com');
liveagent.addCustomDetail('Ev', '9000').map('Account', 'Teste_Live', false, false, false).saveToTranscript('ESTRUTURA_VENDAS__c');
liveagent.init('https://d.la2c1cs.salesforceliveagent.com/chat', '572e00000004CQ4', '00De0000005W2ot');
</script>

</apex:page>

Visualforce code where the user will receive two parameters (Email, Ev) fill in the name and start chatting. The information passed to the salesforce, Email, Ev and name must be saved in LiveChatTranscript object.: 
<apex:page controller="ControllerLiveAgentEmissaoAuto" showHeader="false" title="Atendimento SulAmérica">
<html>
<head>
    <script type="text/javascript">
(function() { 
  function handlePageLoad() {
    var endpointMatcher = new RegExp("[\\?\\&]endpoint=([^&#]*)");
    document.getElementById('prechatForm').setAttribute('action',
    decodeURIComponent(endpointMatcher.exec(document.location.search)[1]));
  } 
  if (window.addEventListener) {
    window.addEventListener('load', handlePageLoad, false);
  } else { 
    window.attachEvent('onload', handlePageLoad, false);
  }
})(); 
</script>

<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 == 'wolf') document.getElementById('emailForm').value = details.customDetails[i].value;
    if(details.customDetails[i].label == 'Ev') document.getElementById('codEv').value = details.customDetails[i].value;
     }  
 };
    </script>
    

<script type='text/javascript'>
 liveagent.details.preChatInit('https://d.la2c1cs.salesforceliveagent.com/chat','detailCallback');
</script>


    <style type="text/css">
                .custPopup{
                background-color: white;
                border-width: 2px;
                border-style: solid;
                z-index: 9999;
                left: 25%;
                padding:10px;
                position: absolute;            
                width: 55%;                       
                top:100px;
                }
                .popupBackground{
                background-color:black;
                opacity: 0.20;
                filter: alpha(opacity = 20);
                position: absolute;
                width: 100%;
                height: 100%;
                top: 0;
                left: 0;
                z-index: 9998;
                }
            </style>       
</head>
<body>

<form method="post" id="prechatForm">
<apex:image url="{!$Resource.LOGO}" />
<!--<apex:sectionHeader subtitle="" title="Chat de Atendimento"/>-->

<apex:pageBlock title="Informações">

<!-- Detalhe inputs -->
<div>
Nome: <input type="text" name="liveagent.prechat:Nome" style="margin-left: 30px;" id="nome"/><br /><br />
Sobrenome: <input type="text" name="liveagent.prechat:Sobrenome" /><br /><br />
Email: <input type="text" id="emailForm" name="liveagent.prechat:Email" style="margin-left: 32px;" /><br /><br />
Ev: <input type="text" id="codEv" name="liveagent.prechat:Ev" style="margin-left: 32px;" /><br /><br />
</div>


<!-- Detalha os campos passados pelo usuário --> 
<!-- ANTIGO <input type="hidden" name="liveagent.prechat.findorcreate.map:Account" value="FirstName,Nome;LastName,Sobrenome;PersonEmail,Email;" />-->
<input type="hidden" name="liveagent.prechat.findorcreate.map:Account" value="FirstName,Nome;LastName,Sobrenome;PersonEmail,Email;ESTRUTURA_VENDAS__c,Ev;RecordType,{!tipoRegistro}" />


<!-- Busca o e-mail passado exatamente como digitado  -->
<input type="hidden" name="liveagent.prechat.findorcreate.map.doFind:Account" value="PersonEmail,true;" />
<input type="hidden" name="liveagent.prechat.findorcreate.map.isExactMatch:Account" value="PersonEmail,true;" />

<!-- Se o contato não for encontrado, o mesmo será criado -->

<!-- ANTIGO <input type="hidden" name="liveagent.prechat.findorcreate.map.doCreate:Account" value="FirstName,true;LastName,true;PersonEmail,true;" />-->
<input type="hidden" name="liveagent.prechat.findorcreate.map.doCreate:Account" value="FirstName,true;LastName,true;PersonEmail,true;ESTRUTURA_VENDAS__c,true;RecordType,true" />


<!-- Salva o contato e lança na transcrição -->
<input type="hidden" name="liveagent.prechat.findorcreate.saveToTranscript:Account" value="Account"/>

<!-- Mostra o usuário criado -->
<input type="hidden" name="liveagent.prechat.findorcreate.showOnCreate:Account" value="true"/>


<!-- <input type="hidden" name="liveagent.prechat:caseOrigin" value="Chat" /> -->
<input type="hidden" name="liveagent.prechat.findorcreate.map:LiveChatTranscript" value="ESTRUTURA_VENDAS__c,Ev;" />

<input type="hidden" name="liveagent.prechat.findorcreate.saveToTranscript:LiveChatTranscript" value="LiveChatTranscript" />
<input type="hidden" name="liveagent.prechat.findorcreate.showOnCreate:LiveChatTranscript" value="true" />


<input type= "hidden" name="liveagent.prechat.findorcreate.linkToEntity:Account" value="LiveChatTranscript,AccountId" />

<input type="submit" value="Fale com um Atendente" id="prechat_submit" /> 

</apex:pageBlock>
</form> 
</body>
</html>
</apex:page>