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.
refreshNavigationItem() for Lightning Experience
This method refreshes in the background. If the list view has unsaved changes, the method returns false and doesn’t refresh the navigation item. The method doesn’t set focus on the navigation tab.
The following navigation items aren’t supported:
- Custom Visualforce tabs
- Custom Aura component tabs
- Custom web tabs
- Dashboards
- Reports
Arguments
LWC Sample Code
This example reloads the current navigation item's home page, such as an object's list view, or its split view.
Aura Components Sample Code
This Aura component has a button that, when pressed, refreshes the navigation item.
Component code:
1<aura:component implements="flexipage:availableForAllPageTypes" access="global">
2 <lightning:navigationItemAPI aura:id="navigationItemAPI"/>
3 <lightning:button label="Refresh navigation item" onclick="{!c.refreshNavigationItem}"/>
4</aura:component>Controller code:
1({
2 refreshNavigationItem : function(component, event, helper) {
3 var navigationItemAPI = component.find("navigationItemAPI");
4 navigationItemAPI.refreshNavigationItem().then(function(response) {
5 console.log(response);
6 })
7 .catch(function(error) {
8 console.log(error);
9 });
10 }
11})Response
This method returns a promise that, upon success, resolves to true. The promise is rejected on error.