setSelectedNavigationItem() for Lightning Experience

Sets the selected navigation item to a specific ID. This method works only in Lightning console apps.

The method provides the same argument for both Aura Components and Lightning Web Components (LWC).

NameTypeDescription
developerNamestringThe API name of the navigation item to select. Examples include 'standard-Account', 'standard-Contact', and 'MyCustomObject__c'

This example switches the active navigation item to a different item in a Lightning console app.

This example finds a navigation item by label using both getNavigationItems() and setSelectedNavigationItem().

This Aura component has a button that, when pressed, sets the specified ID as the selected navigation item.

Component code:

Controller code:

This method returns a promise that, upon success, resolves to true.