initFileTransfer()
Initiates the process of transferring a file from a customer to an agent. Available in API version 31.0 or later.
Syntax
sforce.console.chat.initFileTransfer(chatKey:String, entityId:String, (optional)callback:Function)
Arguments
Name | Type | Description |
---|---|---|
chatKey | String | The chat key for the chat the file is transferred from. |
entityId | String | The ID of the transcript object to attach the transferred file to. |
callback | function | JavaScript method that is called when the method is completed. |
Sample Code–Visualforce
<apex:page>
<apex:includeScript value="/support/console/63.0/integration.js"/>
<a href="#" onClick="testInitFileTransfer();return false;">Init file transfer</a>
<script type="text/javascript">
function testInitFileTransfer() {
//Gets the value for 'myChatKey'from the getChatRequests() or onChatRequested() methods.
//These values are for example purposes only.
var chatKey = 'myChatKey'; var entityId = 'myEntityId';
sforce.console.chat.initFileTransfer(chatKey, entityId, fileSuccess);
}
function fileSuccess(result) {
//Reports whether initiating the file transfer was successful.
if (result.success == true) {
alert('Initiating file transfer was successful.');
} else {
alert('Initiating file transfer was not successful.');
}
};
</script>
</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 the request to transfer a file was sent successfully; false if the request wasn’t sent successfully. |