Newer Version Available
lightning:omniToolkitAPI (Beta)
The lightning:omniToolkitAPI component (beta) enables a component in the utility bar for Omni-Channel to use methods like returning a list of open work items for an agent. Omni-Channel routes work to agents in the console.
This example includes a button to accept a work item that’s assigned to an agent in the Omni-Channel utility.
1<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
2 <lightning:omniToolkitAPI aura:id="omniToolkit" />
3 <lightning:button label="Accept" onClick="{! c.acceptWork }" />
4</aura:component>The button in the component calls the following client-side controller.
1({
2 acceptWork: function(cmp, evt, hlp) {
3 var omniAPI = cmp.find("omniToolkit");
4 omniAPI.getAgentWorks({
5 callback: function(result) {
6 var works = JSON.parse(result.works);
7 var work = works[0];
8 omniAPI.acceptAgentWork({
9 workId: work.workId,
10 callback: function(result2) {
11 if (result2.success) {
12 console.log("Accepted work successfully");
13 } else {
14 console.log("Accept work failed");
15 }
16 }
17 });
18 }
19 });
20 }
21 })All the methods are asynchronous, so they return the response in an object in a callback method.
MethodsThis component supports the following methods.
acceptAgentWork({workId, callback}): Accepts a work item that’s assigned to an agent.
- workId (string): The ID of the work item the agent accepts.
- callback (function): Optional. Function called when an agent accepts the work item associated with the workId.
closeAgentWork({workId, callback}): Changes the status of a work item to Closed and removes it from the list of work items.
- workId (string): The ID of the work item that’s closed.
- callback (function): Optional. Function called when the work item associated with the workId is closed.
declineAgentWork({workId, declineReason, callback}): Declines a work item that’s assigned to an agent.
- workId (string): The ID of the work item that the agent declines.
- declineReason (string): Optional. The provided reason for why the agent declined the work request.
- callback (function): Optional. Function called when an agent declines the work item associated with the workId.
getAgentWorks({callback}): Returns a list of work items that are currently assigned to an agent and open in the agent’s workspace.
- callback (function): Optional. Function called when the list of an agent’s work items is retrieved.
getAgentWorkload({callback}): Retrieves an agent’s currently-assigned workload. Use this method for rerouting work to available agents.
- callback (function): Optional. Function called when the agent’s configured capacity and work retrieved.
getServicePresenceStatusChannels({callback}): Retrieves the service channels that are associated with an Omni-Channel user’s current presence status.
- callback (function): Optional. Function called when the channels associated with a presence status are retrieved.
getServivePresenceStatusId({callback}): Retrieves an agent’s current presence status.
- callback (function): Optional. Function called when the agent’s presence status is retrieved.
login({statusId, callback}): Logs an agent into Omni-Channel with a specific presence status.
- statusId (string): The ID of the presence status.
- callback (function): Optional. Function called when the agent is logged in with the presence status associated with statusId.
logout({callback}): Logs an agent out of Omni-Channel.
- callback (function): Optional. Function called when the agent is logged out of Omni-Channel.
setServicePresenceStatus({statusId, callback}): Sets an agent’s presence status to a status with a particular ID. We log the user into presence if that user isn’t already logged in. This removes the need for you to make additional calls.
- statusId (string): The ID of the presence status you want to set the agent to.
- callback (function): Optional. Function called when the agent’s status is changed to the presence status associated with statusId.
Attributes
| Attribute Name | Attribute Type | Description | Required? |
|---|---|---|---|
| body | Component[] | The body of the component. In markup, this is everything in the body of the tag. |