endChat()
エージェントが現在参加しているチャットを終了します。API バージョン 29.0 以降で使用できます。
構文
1sforce.console.chat.endChat(chatKey:String, (optional)callback:Function)引数
| 名前 | 型 | 説明 |
|---|---|---|
| chatKey | String | 終了する参加中のチャットのチャットキー。 |
| callback | function | メソッドの完了時にコールされる JavaScript メソッド。 |
サンプルコード – Visualforce
1<apex:page>
2 <apex:includeScript value="/support/console/29.0/integration.js"/>
3 <a href="#" onClick="testEndChat();return false;">End Chat</a>
4
5 <script type="text/javascript">
6 function testEndChat() {
7 //Get the value for 'myChatKey'from the getEngagedChats() or onChatStarted() methods.
8 //These values are for example purposes only
9 var chatKey = 'myChatKey';
10 sforce.console.chat.endChat(chatKey, endSuccess);
11 }
12
13 function endSuccess(result) {
14 //Report whether ending the chat was succesful
15 if (result.success == true) {
16 alert('Ending the chat was successful');
17 } else {
18 alert('Ending the chat was not successful');
19 }
20 };
21 </script>
22</apex:page>