Newer Version Available
onFileTransferCompleted()
Registers a function to call when a file is transferred from a customer to an agent.
Available in API version 31.0 or later.
Syntax
1sforce.console.chat.onFileTransferCompleted(chatKey:String, callback:Function)Arguments
| Name | Type | Description |
|---|---|---|
| chatKey | String | The chat key for the chat the file was transferred from. |
| callback | function | JavaScript method that is called when the method is complete. |
Sample CodeāVisualforce
1<apex:page>
2 <apex:includeScript value="/support/console/65.0/integration.js"/>
3 <a href="#" onClick="testOnFileComplete();return false;">test on file transfer complete</a>
4
5 <script type="text/javascript">
6 function testOnFileComplete() {
7 //Gets the value for 'myChatKey'from the getChatRequests() or onChatRequested() methods.
8 //These values are for example purposes only.
9 var chatKey = 'myChatKey';
10 sforce.console.chat.onFileTransferCompleted(chatKey, fileSuccess);
11 }
12
13 function fileSuccess(result) {
14 //Reports status of the file transfer.
15 if (result.success == true) {
16 alert('File transfer was successful.');
17 } else {
18 alert('File transfer was not successful.');
19 }
20 };
21 </script>
22</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 |
|---|---|---|
| attachmentId | String | The ID of the object created for the transferred file. |
| success | Boolean | true if firing event was successful; false if firing event was unsuccessful. |