login for Lightning Experience

Logs an agent in to Omni-Channel with a specific presence status.

Arguments 

NameTypeDescription
statusIdstringThe ID of the presence status. Agents must be given access to this presence status through their associated profile or permission set.

Sample Code 

Component code:

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

Controller code:

1({
2    login: function(cmp, evt, hlp) {
3        var omniAPI = cmp.find("omniToolkit");
4        omniAPI.login({statusId: "0N5xx0000000001"}).then(function(result) {
5            if (result) {
6                console.log("Login successful");
7            } else {
8                console.log("Login failed");
9            }
10        }).catch(function(error) {
11            console.log(error);
12        });
13    }
14})

Response 

This method returns a promise that, upon success, resolves to true and is rejected on error.