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) declineReason:String, (optional) callback:function)Arguments
| Name | Type | Description |
|---|---|---|
| workId | String | The ID of the work item that the agent declines. |
| declineReason | String | The provided reason for why the agent declined the work request. |
| callback | function | JavaScript method to call when an agent declines the work item associated with the workId. |
Sample Code–Visualforce
1<apex:page >
2 <apex:includeScript value="/support/console/64.0/integration.js"/>
3 <a href="#" onClick="testDeclineWork();return false;">Decline Assigned Work Item</a>
4
5 <script type="text/javascript">
6 function testDeclineWork() {
7 //First, get the ID of the assigned work item to accept it
8 sforce.console.presence.getAgentWorks(function(result) {
9 if (result.success) {
10 var works = JSON.parse(result.works);
11 var work = works[0];
12 sforce.console.presence.declineAgentWork(work.workId, function(result) {
13 if (result.success) {
14 alert('Declined work successfully');
15 } else {
16 alert('Decline work failed');
17 }
18 });
19 }
20 });
21 }
22 </script>
23</apex:page>