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
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="testOnFileComplete();return false;">test on file transfer complete</a>
20
21 <script type="text/javascript">
22 function testOnFileComplete() {
23 //Gets the value for 'myChatKey'from the getChatRequests() or onChatRequested() methods.
24 //These values are for example purposes only.
25 var chatKey = 'myChatKey';
26 sforce.console.chat.onFileTransferCompleted(chatKey, fileSuccess);
27 }
28
29 function fileSuccess(result) {
30 //Reports status of the file transfer.
31 if (result.success == true) {
32 alert('File transfer was successful.');
33 } else {
34 alert('File transfer was not successful.');
35 }
36 };
37 </script>
38</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. |