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.
updateUtility() for Lightning Experience
Arguments
Optional parameters are passed into an object as the last argument of the method.
| Name | Type | Description |
|---|---|---|
| utilityId | string | The ID of the utility to update. |
| utilityAttrs | object | Optional. Attributes that specify the appearance of the icon.
|
LWC Sample Code
This component opens a utility using the enclosing utility ID.
1import { LightningElement, wire } from 'lwc';
2import { updateUtility, EnclosingUtilityId } from 'lightning/platformUtilityBarApi';
3
4export default class UpdatePanelExample extends LightningElement {
5 @wire(EnclosingUtilityId) utilityId;
6
7 utilityAttrs = {
8 label: 'Account Insights',
9 icon: 'einstein',
10 iconVariant: 'success',
11 highlighted: true
12 }
13
14 handleUpdate() {
15 if (this.utilityId) {
16 return updateUtility(this.utilityId, this.utilityAttrs);
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
Returns a promise that resolves to true if successful. The promise is rejected on error.