Newer Version Available
login for Lightning Experience
Logs an agent in to Omni-Channel with a specific presence status.
Arguments
| Name | Type | Description |
|---|---|---|
| statusId | string | The ID of the presence status. Agents must be given access to this presence status through their associated profile or permission set. |
| callback | function | JavaScript method to call when the agent is logged in with the presence status associated with statusId. |
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({
5 statusId: "0N5xx0000000001",
6 callback: function(result) {
7 if (result.success) {
8 console.log("Login successful");
9 } else {
10 console.log("Login failed");
11 }
12 }
13 });
14 }
15})