Newer Version Available
cancelFileTransferByAgent()
Indicates that a file transfer request has been canceled by an agent. Available in API version 31.0 or later.
Syntax
1sforce.console.chat.cancelFileTransferByAgent(chatKey:String, (optional)callback:Function)Arguments
| Name | Type | Description |
|---|---|---|
| chatKey | String | The chat key for the chat for which the agent canceled the file transfer request. |
| callback | function | JavaScript method that is called when the method is completed. |
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/31.0/integration.js"/>
19 <a href="#" onClick="testCancelFileTransfer();return false;">Cancel file transfer</a>
20
21 <script type="text/javascript">
22 function testCancelFileTransfer() {
23 //Gets the value for 'myChatKey'from the getChatRequests() or onChatRequested()
24 methods.
25 //These values are for example purposes only.
26 var chatKey = 'myChatKey';
27 sforce.console.chat.cancelFileTransferByAgent(chatKey, fileSuccess);
28 }
29
30 function fileSuccess(result) {
31 //Report whether canceling was successful
32 if (result.success == true) {
33 alert('Canceling file transfer was successful.');
34 } else {
35 alert('Canceling file transfer was not successful.');
36 }
37 };
38 </script>
39</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 properties:
| Name | Type | Description |
|---|---|---|
| success | Boolean | true if canceling the file transfer request was successful; false if canceling the file transfer request wasn’t successful. |