Newer Version Available
declineAgentWork
Declines a work item that’s assigned to an agent. Available in API versions 32.0 and
later.
Syntax
1sforce.console.presence.declineAgentWork(workId:String, (optional) callback:function)Arguments
| Name | Type | Description |
|---|---|---|
| workId | String | The ID of the work item that the agent declines. |
| callback | function | JavaScript method to call when an agent declines the work item associated with the workId. |
Sample Code–Visualforce
1swfobject.registerObject("clippy.codeblock-1", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17<apex:page >
18 <apex:includeScript value="/support/console/34.0/integration.js"/>
19 <a href="#" onClick="testAcceptWork();return false;">Accept Assigned Work Item</a>
20
21 <script type="text/javascript">
22 function testAcceptWork() {
23 //First get the ID of the assigned work item to accept it
24 sforce.console.presence.getAgentWorks(function(result) {
25 if (result.success) {
26 var works = JSON.parse(result.works);
27 var work = works[0];
28 if (!work.isEngaged) {
29 //Now that we have the assigned work item ID, we can accept it
30 sforce.console.presence.acceptAgentWork(work.workId, function(result) {
31 if (result.success) {
32 alert('Accepted work successfully');
33 } else {
34 alert('Accept work failed');
35 }
36 });
37 } else {
38 alert('The work item has already been accepted');
39 }
40 }
41 });
42 }
43 </script>
44</apex:page>