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
Andrew GrossAndrew Gross 

Live Agent Deployment Customization

Hi Everyone,

 

According to the Live Agent dev guide, you can pass information through deployment code:

http://www.salesforce.com/developer/docs/live_agent_dev/index.htm

 

My question is, do you need this code to be hosted on a sfdc site?  What if my chat button is exposed on an external website?  Here is the code that they provide, but as you can see it is enclosed in an </apex:page> tag.

 

   <!-- Deployment code --> 
<script type='text/javascript'
src='https://c.la-blitz01.soma.salesforce.com/content/g/deployment.js'></script>

<script type='text/javascript'>
   // An auto query that searches contacts whose email field matches “john@acme.com”     
   liveagent.addCustomDetail(‘Contact E-mail’, ‘john@acme.com’).map(‘Contact’, ‘Email’, false, true);
   // A fast-fill to populate a contact’s name with “John Doe”
   liveagent.addCustomDetail(‘Contact Name’, ‘John Doe’).map(‘Contact’, ‘Name’, true, false); 
   // Saves the custom detail to a custom field on LiveChatTranscript at the end of a chat     
   liveagent.addCustomDetail(‘Company’, ‘Acme’).saveToTranscript(‘Company__c’);     
   // Overrides the display name of the visitor in the agent console when enaged in a chat     
   liveagent.setName(‘John Doe’);      

   liveagent.init('https://d.la-blitz01.soma.salesforce.com/chat', '572D0000000002R', '00DD0000000JXbY'); 
</script>  
</apex:page>

 

Thanks for any insight in advance.

 

-Andrew

lniet001lniet001

<apex:page showHeader="false">
<!-- This script takes the endpoint URL parameter passed from the deployment page and makes it the action for the form -->
<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>Pre-chat Form</h1>
<form method='post' id='prechatForm'>
What is your full name?<br/> <input type='text' name='liveagent.prechat:Name' id='prechat_name_field' /><br />
What is your panther Id?<br/> <input type='text' name='liveagent.prechat:PantherId' id='prechat_pantherid_field' /><br />
Course Prefix and Section<br/> <input type='text' name='liveagent.prechat:CoursePrefixSection' id='prechat_courseprefixsection_field' /><br />
Email Address<br/> <input type='text' name='liveagent.prechat:Email' /><br />
Reason for visit<br/> <input type='text' name='liveagent.prechat:Reason' /><br />
<!-- Creates an auto-query for a matching Contact record’s Email field based on the value of the liveagent.prechat:Email field -->


<input type="hidden" name="liveagent.prechat.query:Email" value="Contact,Contact.Email"/>
<input type="hidden" name="liveagent.prechat.query:Name" value="Contact,Contact.Name"/>
<input type="hidden" name="liveagent.prechat.query:PantherId" value="Contact,Contact.Student_Id__c"/>

 

 

 

<input type='submit' value='Request Chat' id='prechat_submit'/>
<style type="text/css">
p {font-weight: bolder }
</style>
</form>
</apex:page>

 

I can query based on user input, but can't it to work on custom fields yet. At least is a start