Newer Version Available
getAllUtilityInfo() for Lightning Experience
Returns the state of all utilities as an array of utilityInfo objects.
Arguments
None.
Sample Code
This component has a button that, when pressed, retrieves all utilityInfo objects and opens the first utility, ordered by ID.
Component code:
1<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
2 <lightning:utilityBarAPI aura:id="utilitybar" />
3 <lightning:button label="Get All Utility Info" onclick="{! c.getAllUtilityInfo }" />
4</aura:component>Controller code:
1({
2 getAllUtilityInfo : function(component, event, helper) {
3 var utilityAPI = component.find("utilitybar");
4 utilityAPI.getAllUtilityInfo().then(function(response) {
5 var myUtilityInfo = response[0];
6 utilityAPI.openUtility({
7 utilityId: myUtilityInfo.id
8 });
9 })
10 .catch(function(error) {
11 console.log(error);
12 });
13 }
14})Response
This method returns a promise that, upon success, resolves to an array of utilityInfo objects, containing the following fields.
| Name | Type | Description |
|---|---|---|
| id | string | The ID of the utility. |
| isLoaded | boolean | Whether the utility is loaded. |
| utilityLabel | string | The label of the utility. |
| utilityIcon | string | The SLDS icon ID of the utility’s icon. |
| utilityHighlighted | boolean | Whether the utility is highlighted. |
| utilityVisible | boolean | Whether the utility is visible. |
| panelHeaderLabel | string | The label of the utility panel. |
| panelHeaderIcon | string | The SLDS icon ID of the utility panel’s icon. |
| panelHeight | integer | The height of the utility panel in pixels. |
| panelWidth | integer | The width of the utility panel in pixels |