1<apex:page>
2 <apex:includeScript value="/support/console/68.0/integration.js"/>
3 <a href="#" onClick="testGetWorks();return false;">Get Agent’s Current Work Items</a>
4
5 <script type="text/javascript">
6 function testGetWorks() {
7 //These values are for example purposes only.
8 sforce.console.presence.getAgentWorks(function(result) {
9 if (result.success) {
10 alert('Get work items successful');
11 var works = JSON.parse(result.works);
12 alert('First Agent Work ID is: ' + works[0].workId);
13 alert('Assigned Entity Id of the first Agent Work is: ' + works[0].workItemId);
14 alert('Is first Agent Work Engaged: ' + works[0].isEngaged);
15 } else {
16 alert('Get work items failed');
17 }
18 });
19 }
20 </script>
21</apex:page>