Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

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

1<apex:page>
2    <apex:includeScript value="/support/console/68.0/integration.js"/>
3     <script type="text/javascript">
4
5     /* Note: Open CTI needs to set call type to before getting it, and call type is INTERNAL/INBOUND/OUTBOUND.   
6      */
7
8           var callback2 = function (result) {
9              alert('Call attached data  is ' + result.data + '\n Call Type is ' + result.type);
10     
11           };
12
13           /* Retrieving call ID of first call that came in and 
14            * calling getCallAttachedData() to retrieve call data.
15            */
16           var callback1 = function (result) {
17                if (result.ids && result.ids.length > 0) {
18                  sforce.console.cti.getCallAttachedData(result.ids[0], callback2, {getCallType:true});
19                }
20           };
21
22          //Note that we are using the CTI submodule here
23          function testGetCallAttachedData() {
24            sforce.console.cti.getCallObjectIds(callback1);
25         };
26
27     </script>
28  <h1>CTI</h1>
29   <button onclick="testGetCallAttachedData()">getAttachedData</button>
30</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'.