The lightning:omniToolkitAPI component 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.
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 omniAPI5 .getAgentWorks()6 .then(function(result){7 var works = JSON.parse(result.works);8 var work = works[0];9 omniAPI10 .acceptAgentWork({workId: work.workId})11 .then(function(result2){12 if(result2){13 console.log("Accepted work successfully");14}else{15 console.log("Accept work failed");16}17})18 .catch(function(error){19 console.log(error);20});21})22 .catch(function(error){23 console.log(error);24});25},26});
Methods
This component supports the following methods. For more information on these methods, see the Omni-Channel Developer Guide.
acceptAgentWork({workId}): Accepts a work item that’s assigned to an agent.
workId (string): The ID of the work item the agent accepts.
Returns a Promise. Success resolves to true. The Promise is rejected on error.
closeAgentWork({workId}): 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.
Returns a Promise. Success resolves to true. The Promise is rejected on error.
declineAgentWork({workId, declineReason}): 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.
Returns a Promise. Success resolves to true. The Promise is rejected on error.
getAgentWorks(): Returns a list of work items that are currently assigned to an agent and open in the agent’s workspace.
Returns a Promise. Success resolves to an array of work objects. The Promise is rejected on error.
getAgentWorkload(): Retrieves an agent’s currently-assigned workload. Use this method for rerouting work to available agents.
Returns a Promise. Success resolves to configuredCapacity, currentWorkload, configuredInterruptibleCapacity and currentInterruptibleWorkload properties. The Promise is rejected on error.
getServicePresenceStatusChannels(): Retrieves the service channels that are associated with an Omni-Channel user’s current presence status.
Returns a Promise. Success resolves to an array of channel objects. The Promise is rejected on error.
getServicePresenceStatusId(): Retrieves an agent’s current presence status.
Returns a Promise. Success resolves to statusName, statusApiName and statusId properties. The Promise is rejected on error.
login({statusId}): Logs an agent into Omni-Channel with a specific presence status.
statusId (string): The ID of the presence status.
Returns a Promise. Success resolves to true. The Promise is rejected on error.
logout(): Logs an agent out of Omni-Channel.
Returns a Promise. Success resolves to true. The Promise is rejected on error.
setServicePresenceStatus({statusId}): 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.
Returns a Promise. Success resolves to statusName, statusApiName, statusId properties and an array of channel objects. The Promise is rejected on error.
raiseAgentWorkFlag({workId, message}): Raises a flag for this agent work item.
workId (string): The ID of the work item to raise the flag on.
message (string): Optional. The message associated with this flag.
Returns a Promise. Success resolves to true. The Promise is rejected on error.
lowerAgentWorkFlag({workId}): Lowers a flag for this agent work item.
workId (string): The ID of the work item to lower the flag on.
Returns a Promise. Success resolves to true. The Promise is rejected on error.
Attributes
Name
Description
Type
Default
Required
body
The body of the component. In markup, this is everything in the body of the tag.
Aura.Component[]
Methods
Name
Description
Argument Name
Argument Type
Argument Description
acceptAgentWork
Accepts a work item that’s assigned to an agent.
arguments
Object
Argument object with values for workId and callback.
closeAgentWork
Changes the status of a work item to Closed and removes it from the Omni-Channel widget.
arguments
Object
Argument object with values for workId and callback.
declineAgentWork
Declines a work item that’s assigned to an agent.
arguments
Object
Argument object with values for workId and callback.
getAgentWorkload
Returns the agent’s currently assigned workload.
arguments
Object
Argument object with value for callback.
getAgentWorks
Returns a list of work items that are currently assigned to an agent and open in the agent’s workspace.
arguments
Object
Argument object with value for callback.
getServicePresenceStatusChannels
Returns the service channels that are associated with an Omni-Channel user’s current presence status.
arguments
Object
Argument object with value for callback.
getServicePresenceStatusId
Returns the agent’s current presence status.
arguments
Object
Argument object with value for callback.
login
Logs an agent into Omni-Channel with a specific presence status.
arguments
Object
Argument object with values for statusId and callback.
logout
Logs an agent out of Omni-Channel.
arguments
Object
Argument object with value for callback.
lowerAgentWorkFlag
Lowers a flag for this agent work item.
arguments
Object
Argument object with value for workId and callback.
raiseAgentWorkFlag
Raises a flag for this agent work item.
arguments
Object
Argument object with value for workId, message and callback.
setServicePresenceStatus
Sets an agent's presence status to a status with a particular Id.
arguments
Object
Argument object with values for statusId and callback.