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/56.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>