この文章は Salesforce 機械翻訳システムを使用して翻訳されました。詳細はこちらをご参照ください。
英語に切り替える

onFileTransferCompleted()

顧客からエージェントにファイルが転送されるとコールされる関数を登録します。API バージョン 31.0 以降で使用できます。

構文

1sforce.console.chat.onFileTransferCompleted(chatKey:String, callback:Function)

引数

名前 説明
chatKey String ファイルの転送元のチャットのチャットキー。
callback function メッセージの完了時にコールされる JavaScript メソッド。

サンプルコード – Visualforce

1<apex:page>
2    <apex:includeScript value="/support/console/31.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>

応答

このメソッドは非同期であるため、コールバックメソッドのオブジェクトで応答を返します。応答オブジェクトには次のプロパティが含まれます。

名前 説明
attachmentId String 転送されたファイルのために作成されるオブジェクトの ID。
success Boolean イベントが正常に起動された場合は true、イベントが正常に起動されなかった場合は false