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

closeAgentWork

作業項目の状況を「完了」に変更し、オムニチャネルウィジェットの作業項目リストから削除します。API バージョン 32.0 以降で使用できます。

構文

1sforce.console.presence.closeAgentWork(workId:String, (optional) callback:function)

引数

名前 説明
workId String 完了した作業項目の ID。
callback function workId に関連付けられた作業項目が完了したときにコールする JavaScript メソッド。

サンプルコード – Visualforce

1<apex:page>
2     <apex:includeScript value="/support/console/59.0/integration.js"/>
3     <a href="#" onClick="testCloseWork();return false;">Close Engaged Work Item</a>
4     <script type="text/javascript">
5         function testCloseWork() {
6             //First get the ID of the engaged work item to close it
7             sforce.console.presence.getAgentWorks(function(result) {
8                 if (result.success) {
9                     var works = JSON.parse(result.works);
10                     var work = works[0];
11                     if (work.isEngaged) {
12                         //Now that we have the engaged work item ID, we can close it 
13                         sforce.console.presence.closeAgentWork(work.workId,function(result) {
14                             if (result.success) {
15                                  alert('Closed work successfully');
16                             } else {
17                                 alert('Close work failed');
18                             }
19                         });
20                     } else {
21                         alert('The work item should be accepted first');
22                     }
23                 }
24             });
25         }
26     </script>
27</apex:page>

応答

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

名前 説明
success Boolean 作業項目が正常に完了した場合は true、作業項目が正常に完了しなかった場合は false