getAgentWorkload for Lightning Experience

Retrieves an agent’s currently assigned workload. Use this method to reroute work to available agents.

Sample Code 

Component code:

1<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
2    <lightning:omniToolkitAPI aura:id="omniToolkit" />
3    <lightning:button label="Get workload" onclick="{! c.getAgentWorkload }" /> 
4</aura:component>

Controller code:

1({
2    getAgentWorkload: function(cmp, evt, hlp) {
3        var omniAPI = cmp.find("omniToolkit");
4        omniAPI.getAgentWorkload().then(function(result) {
5            console.log('Retrieved Agent Configured Capacity and Current Workload successfully');
6            console.log('Agent\'s configured capacity is: ' + result.configuredCapacity);
7            console.log('Agent\'s currently assigned workload is: ' + result.currentWorkload);
8        }).catch(function(error) {
9            console.log(error);
10        });
11    }
12})

Response 

This method returns a promise that, upon success, resolves to an object containing the following fields.

NameTypeDescription
configuredCapacitynumberThe agent’s configured primary capacity (work that’s assigned to the current user) through Presence Configuration.
currentWorkloadnumberThe agent’s currently assigned primary workload.
configuredInterruptibleCapacityNumberIndicates the agent’s configured interruptible capacity (that is, work that’s assigned to the current user) through Presence Configuration.
currentInterruptibleWorkloadNumberIndicates the agent’s currently assigned interruptible workload.