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
James Boutel 10James Boutel 10 

Live Agent mapping custom details to fields

Hi everyone,

I have implemented Live Agent but mapping custom details to the Lead object fields doesn't seem to be working.
When I accept a chat it displays the "Details" tab with all the custom details on it. Then it opens a Lead tab asking me to select the Record type. After doing that it presents me with a "New Lead" page - but all the fields are blank.. none of them have been populated with the custom detail values.

Any help is greatly appreciated!
Code Below:- 
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Untitled</title>
</head>
<body>

<img id="liveagent_button_online_5733E0000008Of4" style="display: none; border: 0px none; cursor: pointer" onclick="liveagent.startChat('5733E0000008Of4')" src="https://livechat-jbrcapital.cs82.force.com/chattest/resource/1476268469000/OnlineButton" />
<img id="liveagent_button_offline_5733E0000008Of4" style="display: none; border: 0px none; " src="https://livechat-jbrcapital.cs82.force.com/chattest/resource/1476268469000/OfflineButton" />
<script type="text/javascript">
if (!window._laq) { window._laq = []; }
window._laq.push(function(){liveagent.showWhenOnline('5733E0000008Of4', document.getElementById('liveagent_button_online_5733E0000008Of4'));
liveagent.showWhenOffline('5733E0000008Of4', document.getElementById('liveagent_button_offline_5733E0000008Of4'));
});</script>


<script type='text/javascript' src='https://c.la1-c2cs-frf.salesforceliveagent.com/content/g/js/37.0/deployment.js'></script>
<script type='text/javascript'>
liveagent.addCustomDetail("Campaign_ID", "XXXX");
liveagent.addCustomDetail("RecordTypeDetail", "End user prospects");
liveagent.addCustomDetail("enquiry_method", "XXXX");
liveagent.addCustomDetail("member_status", "XXXX");
liveagent.addCustomDetail("traffic_source_original", "XXXX");
liveagent.addCustomDetail("channel_original", "XXXX");
liveagent.addCustomDetail("sub_channel_original", "XXXX");
liveagent.addCustomDetail("traffic_source_session", "XXXX");;
liveagent.addCustomDetail("channel_session", "XXXX");
liveagent.addCustomDetail("sub_channel_session", "XXXX");
liveagent.addCustomDetail("arrived_from_url", "XXXX");
liveagent.addCustomDetail("arrived_from_session", "XXXX");
liveagent.addCustomDetail("gclid_original", "XXXX");
liveagent.addCustomDetail("gclid_session", "XXXX");
liveagent.addCustomDetail("date_enquiry", "XXXX");
liveagent.addCustomDetail("date_original", "XXXX");
liveagent.addCustomDetail("landing_page_session", "XXXX");
liveagent.addCustomDetail("landing_page_original", "XXXX");
liveagent.addCustomDetail("named_referrer", "XXXX");

liveagent.findOrCreate("Lead").map("Campaign", "Campaign_ID", false,false,true)
.map("RecordType", "RecordTypeDetail", false,false,true)
.map("Enquiry_Method__c", "enquiry_method", false,false,true)
.map("Status", "member_status", false,false,true)
.map("trafficSourceForOriginalVisit__c", "traffic_source_original", false,false,true)
.map("campaignDetailsForOriginalVisit__c", "channel_original", false,false,true)
.map("Sub_Channel_Original__c", "sub_channel_original", false,false,true)
.map("trafficSourceForEnquiryVisit__c", "traffic_source_session", false,false,true)
.map("campaignDetailsForEnquiryVisit__c", "channel_session", false,false,true)
.map("Sub_Channel_Enquiry__c", "sub_channel_session", false, false, true)
.map("arrivedFromURL__c", "arrived_from_url", false,false,true)
.map("Arrived_from_URL_Session__c", "arrived_from_session", false,false,true)
.map("gclid_original__c", "gclid_original", false,false,true)
.map("gclid_session__c", "gclid_session", false,false,true)
.map("dateOfEnquiryVisit__c", "date_enquiry", false,false,true)
.map("dateOfOriginalVisit__c", "date_original", false,false,true)
.map("Landing_Page_Session__c", "landing_page_session", false,false,true)
.map("Landing_Page_Original__c", "landing_page_original", false,false,true)
.map("namedReferrer__c", "named_referrer", false,false,true).saveToTranscript("LeadId").showOnCreate();

liveagent.init('https://d.la1-c2cs-frf.salesforceliveagent.com/chat', '5723E0000008Odc', '00D3E0000008qBC');
</script>
			
</body>
</html>