Newer Version Available

This content describes an older version of this product. View Latest

logout for Lightning Experience

Logs an agent out of Omni-Channel.

Sample Code

Component code:

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

Controller code:

1({
2    logout: function(cmp, evt, hlp) {
3        var omniAPI = cmp.find("omniToolkit");
4        omniAPI.logout().then(function(result) {
5            if (result) {
6                console.log("Logout successful");
7            } else {
8                console.log("Logout 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.