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
1<apex:page>
2 <apex:includeScript value="/support/console/56.0/integration.js"/>
3 <a href="#" onClick="testCancelFileTransfer();return false;">Cancel file transfer</a>
4
5 <script type="text/javascript">
6 function testCancelFileTransfer() {
7 //Gets the value for 'myChatKey'from the getChatRequests() or onChatRequested()
8 methods.
9 //These values are for example purposes only.
10 var chatKey = 'myChatKey';
11 sforce.console.chat.cancelFileTransferByAgent(chatKey, fileSuccess);
12 }
13
14 function fileSuccess(result) {
15 //Report whether canceling was successful
16 if (result.success == true) {
17 alert('Canceling file transfer was successful.');
18 } else {
19 alert('Canceling file transfer was not successful.');
20 }
21 };
22 </script>
23</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. |