getUtilityInfo() for Lightning Experience

Returns the state of the current utility as a utilityInfo object. This method isn’t supported for Lightning Web Components (LWC).

For LWC usage, see getInfo().

Arguments 

NameTypeDescription
utilityIdstringThe ID of the utility for which to retrieve the state.

Aura Components Sample Code 

This component has a button that, when pressed, retrieves the enclosing utility’s info and opens it if it’s not currently visible, and closes it otherwise.

Component code:

1<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
2    <lightning:utilityBarAPI aura:id="utilitybar" />
3    <lightning:button label="Get Utility Info" onclick="{! c.handleGetUtilityInfo }" />
4</aura:component>

Controller code:

1({
2    handleGetUtilityInfo : function(component, event, helper) {
3        var utilityBarAPI = component.find("utilitybar");
4        utilityBarAPI.getUtilityInfo().then(function(response) {
5            if (response.utilityVisible) {
6                utilityBarAPI.minimizeUtility();
7            }
8            else {
9                utilityBarAPI.openUtility();
10            }
11        })
12        .catch(function(error) {
13            console.log(error);
14        });
15    }
16})

Response 

This method returns a promise that resolves to a utilityInfo object representing the enclosing utility, containing the following fields. The promise is rejected on error.

NameTypeDescription
idstringThe ID of the utility.
isLoadedbooleanWhether the utility is loaded.
utilityLabelstringThe label of the utility.
utilityIconstringThe SLDS icon ID of the utility’s icon.
utilityIconVariantstringThe SLDS icon variant of the utility’s icon.
utilityHighlightedbooleanWhether the utility is highlighted.
utilityVisiblebooleanWhether the utility is visible.
utilityPoppedOutbooleanWhether the utility is popped out.
panelHeaderLabelstringThe label of the utility panel.
panelHeaderIconstringThe SLDS icon ID of the utility panel’s icon.
panelHeaderIconVariantstringThe SLDS icon variant of the utility panel’s icon.
panelHeightintegerThe height of the utility panel in pixels.
panelWidthintegerThe width of the utility panel in pixels