No Results
Search Tips:
- Please consider misspellings
- Try different search keywords
Newer Version Available
getDetails
Use the getDetails JavaScript method to access custom details and chat information
that have been passed through the Deployment API and Pre-Chat API
and incorporate them into your Visualforce chat
window.
Usage
Extracts chat information and custom details that have been passed into the chat through the Deployment API and Pre-Chat API and integrates the information into a Visualforce chat window. Call this method within a custom Visualforce chat window.
Call this method when the chat information and custom details change or become available. To verify that these details have become available or have been updated, you need to include the following three required events in the code for your chat window:
1liveagent.addEventListener(liveagent.chasitor.Events.CHAT_REQUEST_SUCCESSFUL, myCallBack);
2 liveagent.addEventListener(liveagent.chasitor.Events.CHAT_ESTABLISHED, newagent);
3 liveagent.addEventListener(liveagent.chasitor.Events.AGENT_CHAT_TRANSFERRED, newagent);You can take a look at how to incorporate these events in the code sample below.
Available in API versions 29.0 and later.
Syntax
liveagent.chasitor.getDetails();
Responses
| Name | Type | Description | Available Versions |
|---|---|---|---|
| details | Object | An object containing all of the custom details to incorporate into your Visualforce chat window. | Available in API versions 29.0 and later. |
The getDetails method returns a details JavaScript object with a structure similar to the following example
object:
1{
2 "geoLocation":{
3 "countryCode":"US",
4 "countryName":"United States",
5 "longitude":-122.4294,
6 "organization":"SALESFORCE.COM",
7 "latitude":37.764496,
8 "region":"CA",
9 "city":"San Francisco"
10
11 },
12 "customDetails":[
13 {
14 "label":"Email",
15 "value":"example@salesforce.com",
16 "transcriptFields":[],
17 "entityMaps":[]
18 },
19 {
20 "label":"Email",
21 "value":"sonic@sega.com",
22 "transcriptFields":["Email__c"],
23 "entityMaps":[
24 {
25 "fieldName":"Email",
26 "isAutoQueryable":true,
27 "entityName":"Contact",
28 "isExactMatchable":true,
29 "isFastFillable":false
30 }]
31 }
32 ],
33 "prechatDetails":[
34 {
35 "label":"prechat field",
36 "value":"any info",
37 "transcriptFields":[],
38 "entityMaps":[]
39 }],
40 “agent” : {
41 "agentName":"jsmith",
42 "userId":"005x0000001JGgr",
43 "transfer":0
44 },
45 "visitorId":"251a5956-bcbc-433d-b822-a87c062e681c",
46}Code Sample
1swfobject.registerObject("clippy.codeblock-2", "9");<apex:page showHeader="false">
2
3<script type='text/javascript'>
4 liveagent.addEventListener(liveagent.chasitor.Events.CHAT_REQUEST_SUCCESSFUL, myCallBack);
5 liveagent.addEventListener(liveagent.chasitor.Events.CHAT_ESTABLISHED, newagent);
6 liveagent.addEventListener(liveagent.chasitor.Events.AGENT_CHAT_TRANSFERRED, newagent);
7
8 function myCallBack() {
9 var details = liveagent.chasitor.getDetails();
10// ..
11 }
12
13 function newagent() {
14 var details = liveagent.chasitor.getDetails();
15// …
16 }
17</script>
18
19<style>
20html {
21 padding: 20px;
22}
23body {
24 background-color: #778899;
25 overflow: hidden;
26 width: 100%;
27 height: 100%;
28 padding: 20px;
29 margin: 0
30}
31#waitingMessage {
32 color:white;
33 height: 100%;
34 width: 100%;
35 vertical-align: middle;
36 text-align: center;
37 display: none;
38 }
39#liveAgentClientChat.liveAgentStateWaiting #waitingMessage { display: table; }
40#liveAgentSaveButton, #liveAgentEndButton { z-index: 2; }
41.liveAgentChatInput {
42 top:8px;
43 height: 25px;
44 border-width: 1px;
45 border-style: solid;
46 border-color: #BB0000;
47 padding: 2px 0 2px 4px;
48 background: #fff;
49 display: block;
50 width: 99%;
51}
52.liveAgentSendButton {
53 display: block;
54 width: 60px;
55 height: 31px;
56 padding: 0 0 3px;
57 position: absolute;
58 top: 0;
59 right: -67px;
60}
61#liveAgentChatLog {
62 border-color: #BB0000;
63 background-image:linear-gradient(#DDEEFF, #AABBCC);
64 box-shadow: 10px 10px 5px #888888;
65 border-radius: 10px;
66 padding:10px;
67 width: auto;
68 height: auto;
69 top: 38px;
70 position: absolute;
71 overflow-y: auto;
72 left: 0;
73 right: 0;
74 bottom: 0;
75}
76</style>
77
78<div style="top: 0; left: 0; right: 0; bottom: 0; position: absolute; padding:10px;">
79<liveAgent:clientchat >
80 <liveAgent:clientChatSaveButton label="Save Chat" />
81 <liveAgent:clientChatEndButton label="End Chat" />
82 <div id="prechatdata">
83 </div>
84 <div style="top: 5px; left: 5px; right: 5px; bottom: 5px; position: absolute; z-index: 0;">
85 <liveAgent:clientChatAlertMessage />
86 <liveAgent:clientChatStatusMessage />
87 <table id="waitingMessage" cellpadding="0" cellspacing="0">
88 <tr>
89 <td>Please wait while you are connected to an available agent.</td>
90 </tr>
91 </table>
92 <div style="top: 0; right: 0; bottom: 41px; left: 0; padding: 0; position: absolute; word-wrap: break-word; z-index: 0;">
93 <liveAgent:clientChatLog />
94 </div>
95 <div style="position: absolute; height: auto; right: 0; bottom: 0; left: 0; margin-right: 67px;">
96 <liveagent:clientChatInput /><liveAgent:clientChatSendButton label="Send"/>
97 </div>
98 </div>
99</liveAgent:clientchat>
100</div>
101</apex:page>