getNavigationItems() for Lightning Experience

Returns information about all the items in the navigation menu. This method works only in Lightning console apps.

None

This example retrieves and inspects all available items within a Lightning console app’s navigation menu.

This example enables users to select a navigation item from a list using both getNavigationItems() and setSelectedNavigationItem().

This component has a button that, when pressed, returns information about the navigation items in a console app.

Component code:

Controller code:

This method returns a promise that, upon success, resolves to an array of navigationItemInfo objects. The promise is rejected on error.

The navigationItemInfo object contains the following fields.

NameTypeDescription
developerNamestringThe navigation item’s developer name that uniquely identifies the item. For example, Salesforce_Account or Your_VF_Page_Name.
labelstringThe navigation item’s label, such as Account or Case.
pageReferenceobjectThe representation of the current page. The object returns information such as: page type (for example standard__objectPage or standard__navItemPage), object API name, and state information for the page.
selectedbooleanTrue if the tab is currently selected, false otherwise.

Here’s the structure of a navigationItemInfo object.

The PageReference structure looks like this.