Home Salesforce Open Utility Bar On Lightning App Load

Open Utility Bar On Lightning App Load

by Dhanik Lal Sahni
Open Utility Bar Automatically SalesforceCodex

Some time we need to open utility bar when lightning app is loaded. This is required when we want to run some background job like update user record or initialize user session when page is loaded.

Use Case:

SalesforceCodex.com is running multi program health system built on Salesforce Platform. Business want when user will open lightning app they will get program selection screen.

Solution:

To handle this business requirement, we can use lightning utility bar. We can put lightning component in utility bar. When lightning app will be loaded that lightning component will open automatically.

Load component on utility bar loaded - Salesforcecodex

We have to check flag ‘Start Automatically‘ for lightning component in utility bar.

Let us see lightning component code which will show program selection on page load.

We have to use getAllUtilityInfo of lightning:utilityBarAPI to get current utility bar and then open that utility bar.

Test Page:

Open Utility Bar On Page Load - SalesforceCodex

References:

https://developer.salesforce.com/docs/component-library/bundle/lightning:utilityBarAPI/documentation

https://developer.salesforce.com/docs/component-library/bundle/lightning:combobox/example

You may also like

1 comment

Open Utilty Bar On the Onload (connectedCallback) functtion LWC Component – GrindSkills April 19, 2022 - 8:28 am

[…] I have LWC Component and I need to open the utility page on the connectedCallback of the page: Somewhat like this: https://salesforcecodex.com/salesforce/open-utility-bar-on-lightning-app-load/ […]

Reply

Leave a Comment