• Salauddin Sheikh
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
I'm working on a lightning component for the service cloud utility bar which should essentially auto log you into Omni Channel once you have been logged into the service console.

In the lightning component controller, I have the following:
({
    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');
                        }
                    }
                });
                
                
            }), 100
        ) 
     //helper.setStatus(cmp, evt, hlp);
    },  
})
In my component I have:
<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
   
 <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <lightning:omniToolkitAPI aura:id="omniToolkit" />
    <!--
        <lightning:utilityBarAPI aura:id="utilitybar" />
        <lightning:button label="Get Status" onclick="{! c.getStatus }" />
        <lightning:button label="Set Status" onclick="{! c.setStatus }" />
  -->
</aura:component>
How do I go about getting this to load automatically? If I click on the lightning component, I will get signed into Omni-channel.  It would be ideal to have this happen on load.