Omni-Channel Lightning Component

Salesforce Omni-Channel is great, but the one downside in our organization is that you have to manually set your status to available in order to receive chat or work requests.

I am in the midst of creating a Background Utility Item which will auto log you into omni-channel.

Omni-Channel Lightning Component

<aura:component implements=”lightning:backgroundUtilityItem” access=”global” >
<aura:handler name=”init” value=”{!this}” action=”{!c.doInit}”/>
<lightning:omniToolkitAPI aura:id=”omniToolkit” />
</aura:component>

Omni-Channel Lightning Component Controller

({
doInit: function(cmp, evt, hlp) {
window.setTimeout(
$A.getCallback(function() {

var omniAPI = cmp.find(“omniToolkit”);
omniAPI.setServicePresenceStatus({
statusId: “0N561000000027Y”,
callback: function(result) {
if (result.success) {
console.log(‘Set status successful’);
console.log(‘Current statusId is: ‘ + result.statusId);
console.log(‘Channel list attached to this status is: ‘ + result.channels);
} else {
console.log(‘Set status failed’);
}
}
});

}), 1000
)
},
})

This works like 90% of the time. There are some kinks which I’m still trying to work out.  For example, sometimes when you open service console you will get an error that says “Error logging into Omni-Channel”.  Not too sure why yet as it seems sporadic.  Clearing broswer cache and re-logging into service console does the trick.  If you have any ideas as to why this is the case, feel free to shoot me a message.

One thought on “Omni-Channel Lightning Component

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.