Newer Version Available
getCallAttachedData()
Returns the attached data of a call represented by the
call object ID or null if there isn’t an active call. The data is returned in JSON
format. This method is for computer-telephony integration (CTI);
it’s only available in API version 24.0 or later.
Syntax
1sforce.console.cti.getCallAttachedData( callObjectId, getCallType, (optional) callback:Function )Arguments
| Name | Type | Description |
|---|---|---|
| callObjectId | string | The call object ID of the call that retrieves the attached data. |
| getCallType | boolean | true if the type of call is returned as either ‘INTERNAL,’ ‘INBOUND,’ or ‘OUTBOUND’; false otherwise. This field is only available in API version 29.0 or later. |
| callback | function | JavaScript method called upon completion of the method. |
Sample Code–Visualforce
1swfobject.registerObject("clippy.codeblock-1", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17<apex:page>
18 <apex:includeScript value="/support/console/29.0/integration.js"/>
19 <script type="text/javascript">
20
21 /* Note: Open CTI needs to set call type to before getting it, and call type is INTERNAL/INBOUND/OUTBOUND.
22 */
23
24 var callback2 = function (result) {
25 alert('Call attached data is ' + result.data + '\n Call Type is ' + result.type);
26
27 };
28
29 /* Retrieving call ID of first call that came in and
30 * calling getCallAttachedData() to retrieve call data.
31 */
32 var callback1 = function (result) {
33 if (result.ids && result.ids.length > 0) {
34 sforce.console.cti.getCallAttachedData(result.ids[0], callback2, {getCallType:true});
35 }
36 };
37
38 //Note that we are using the CTI submodule here
39 function testGetCallAttachedData() {
40 sforce.console.cti.getCallObjectIds(callback1);
41 };
42
43 </script>
44 <h1>CTI</h1>
45 <button onclick="testGetCallAttachedData()">getAttachedData</button>
46</apex:page>Response
This method is asynchronous so it returns its response in an object in a callback method. The response object contains the following fields:
| Name | Type | Description |
|---|---|---|
| data | string | The attached data of a call in JSON format. |
| success | boolean | true if returning the attached data was successful; false if returning the attached data wasn’t successful. |
| type | string | The type of call. Possible values are 'INTERNAL', 'INBOUND', and 'OUTBOUND'. |