Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
getInfo() for Lightning Experience
Arguments
| Name | Type | Description |
|---|---|---|
| utilityId | string | The ID of the utility for which to retrieve the state. |
LWC Sample Code
This component retrieves the utilityInfo object.
1import { LightningElement, wire } from 'lwc';
2import { EnclosingUtilityId, getInfo } from 'lightning/platformUtilityBarApi';
3
4export default class UtilityInfoExample extends LightningElement {
5 @wire(EnclosingUtilityId) utilityId;
6
7 async handleGetUtilityInfo() {
8 try {
9 if (!this.utilityId) {
10 return;
11 }
12 const utilityInfo = await getInfo(this.utilityId);
13 console.log(utilityInfo);
14 }
15 catch (error) {
16 // handle error
17 }
18 }
19}To make your component available for use in a utility bar, specify the lightning__UtilityBar target in the component’s configuration file.
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.
| 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. |
| utilityIconVariant | string | The SLDS icon variant of the utility’s icon. |
| utilityHighlighted | boolean | Whether the utility is highlighted. |
| utilityVisible | boolean | Whether the utility is visible. |
| utilityPoppedOut | boolean | Whether the utility is popped out. |
| panelHeaderLabel | string | The label of the utility panel. |
| panelHeaderIcon | string | The SLDS icon ID of the utility panel’s icon. |
| panelHeaderIconVariant | string | The SLDS icon variant 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 |