0

im new with liveagent configuration and i'm trying to get the filled inputs by user to send to the agent. unfortunately I am unable to send the values, i researched but i didn't found solution. thank you

Here the code:

<apex:page showHeader="false"> 
<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>
<h1>Atendimento</h1> 
<apex:pageBlock >
<form method="post" id="prechatForm"> 
      Nome: <br />
<input type="text" name="liveagent.prechat:name" id="name" /><br /> 
      Sobrenome: <br />
<input type="text" name="liveagent.prechat:lastName" id="lastName" /><br /> 
      Email: <br />
<input type="text" name="liveagent.prechat:email" id="email" /><br /> <br />

      <input type="hidden" name="liveagent.prechat:name" 
      value="Account,Account.Name" /> 
      <input type="hidden" name="liveagent.prechat:lastName" 
      value="Account,Account.LastName" /> 
      <input type="hidden" name="liveagent.prechat.query:Email" value="Email" />  

      <a id="liveagent_button_online_XXXXXXXXXXXXX" href="javascript://Chat" style="display: none;" onclick="liveagent.startChat('XXXXXXXXXXXXX')">Solicitar Atendimento</a>
      <div id="liveagent_button_offline_XXXXXXXXXXXXX" style="display: none;">Desculpe, estamos Offline</div>
       <script type="text/javascript">
        if (!window._laq) { window._laq = []; }
        window._laq.push(function(){liveagent.showWhenOnline('XXXXXXXXXXXXX', document.getElementById('liveagent_button_online_XXXXXXXXXXXXX'));
        liveagent.showWhenOffline('XXXXXXXXXXXXX', document.getElementById('liveagent_button_offline_XXXXXXXXXXXXX'));
        });
        </script>

        <script type='text/javascript' src='https://c.XXXXX.salesforceliveagent.com/content/g/js/35.0/deployment.js'></script>
        <script type='text/javascript'>
        liveagent.init('https://d.XXXX.salesforceliveagent.com/chat', 'XXXXXXXXXXXXX', 'XXXXXXXXXXXXX');
        </script>

<style type="text/css"> 
p {font-weight: bolder } 
</style> 
</form> 
</apex:pageBlock>
</apex:page>

2 Answers 2

0

Are you looking to find or create a record? If so, this is the call to make.

https://developer.salesforce.com/docs/atlas.en-us.live_agent_dev.meta/live_agent_dev/live_agent_creating_records_prechat.htm

I don't know of a straightforward way to pass this information for a "new" record.

0

actually the problem was on my configurations. 'Cause i was using a site that not was working well (resources site). Also i found the site from Peter, with a sample of Live agent and more. This was helpful to i create and solve the problem. Below the code with mixing what i did and Peter.

Hope this help everyone :)

<apex:page >
<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>
    <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:pageBlock title="XXXXX Chat">

<!-- Inputs -->
<div>
Name: <input type="text" name="liveagent.prechat:Name" style="margin-left: 30px;"/><br /><br />
LastName: <input type="text" name="liveagent.prechat:LastName" /><br /><br />
Email: <input type="text" name="liveagent.prechat:Email" style="margin-left: 32px;" /><br /><br />
</div>


<!-- Detail filled by user --> 
<input type="hidden" name="liveagent.prechat.findorcreate.map:Contact" value="FirstName,Name;LastName,LastName;Email,Email;" />

<!-- Find the exact email  -->
<input type="hidden" name="liveagent.prechat.findorcreate.map.doFind:Contact" value="Email,true;" />
<input type="hidden" name="liveagent.prechat.findorcreate.map.isExactMatch:Contact" value="Email,true;" />

<!-- Search for a contact, if not found. Create -->
<input type="hidden" name="liveagent.prechat.findorcreate.map.doCreate:Contact" value="FirstName,true;LastName,true;Email,true;" />

<!-- Salve the contact  -->
<input type="hidden" name="liveagent.prechat.findorcreate.saveToTranscript:Contact" value="Contact" />

<!-- Show the User -->
<input type="hidden" name="liveagent.prechat.findorcreate.showOnCreate:Contact" value="true" />


<input type="hidden" name="liveagent.prechat.findorcreate.map:Case" value="Origin,Origin;" />
<input type="hidden" name="liveagent.prechat.findorcreate.map.doCreate:Case" value="Origin,true;" />
<input type="hidden" name="liveagent.prechat.findorcreate.saveToTranscript:Case" value="Case" />
<input type="hidden" name="liveagent.prechat.findorcreate.showOnCreate:Case" value="true" />

<!-- Link the Contact to the Case -->
<input type= "hidden" name="liveagent.prechat.findorcreate.linkToEntity:Contact" value="Case,ContactId" />

<input type="submit" value="Chat with the consultant!" id="prechat_submit" /> 

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

You must log in to answer this question.

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