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

acceptChat()

チャット要求を受け入れます。API バージョン 29.0 以降で使用できます。このメソッドは API バージョン 37.0 以降のオムニチャネルではサポートされていません。

構文

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

引数

名前 説明
chatKey String 受け入れるチャット要求のチャットキー。
callback function メソッドの完了時にコールされる JavaScript メソッド。

サンプルコード – Visualforce

1<apex:page>
2    <apex:includeScript value="/support/console/52.0/integration.js"/>
3    <a href="#" onClick="testAcceptChat();return false;">Accept Chat</a> 
4
5    <script type="text/javascript">
6        function testAcceptChat() {
7            //Get 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.acceptChat(chatKey, acceptSuccess);
11        }
12        
13        function acceptSuccess(result) {
14            //Report whether accepting the chat was succesful
15            if (result.success == true) {
16                alert('Accepting the chat was successful');
17            } else {
18                alert('Accepting the chat was not successful');
19            }
20        };
21    </script>
22</apex:page>

応答

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

名前 説明
success Boolean チャットが正常に受け入れられた場合は true、チャットの受け入れに失敗した場合は false