setCallAttachedData()

Sets the call data associated with a call object ID. Use to get information or send information between an interaction log and a custom console component.This method is only available in API version 31.0 or later.

Syntax 

1sforce.console.cti.setCallAttachedData( callObjectId:String, callData:JSON string callType:String, (optional)callback:Functional)

Arguments 

NameTypeDescription
callObjectIdstringThe object ID of the call.
callDatastringJSON string that specifies the data to attach to the call.
callTypestringString that specifies the call type, such as internal, inbound, or outbound.
callbackfunctionJavaScript method called upon completion of the method.

Sample Code–Visualforce 

1<apex:page>
2    <A HREF="#" onClick="testSetCallAttachedData();return false">
3          Click here to set call attached data </A>
4
5    <apex:includeScript value="/support/console/68.0/integration.js"/>
6     <script type="text/javascript">
7
8           function testSetCallAttachedData() {
9              //callData must be a JSON string. We assume that your browser has
10              //access to a JSON library.
11              var callData = JSON.stringify({"ANI":"4155551212", "DNIS":"8005551212"});
12
13              //Set the call attached data associated to call id 'call.1'
14              sforce.console.cti.setCallAttachedData('call.1', callData, 'outbound');
15           }
16     </script>
17</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 field:

NameTypeDescription
successbooleantrue if the event firing was successful; false otherwise.