Sub topic 12
Console navigation and workspace tabs
This chapter assumes you already know how Lightning apps, the navigation bar, tabs, list views, and record pages fit together. You should also be comfortable with the terms object, record, and field. Here you will learn how a console app changes that model. You will also learn how to work with workspace tabs and subtabs, and what usually goes wrong.
What a console app is
A console app is a Lightning app that uses the Console navigation style instead of the Standard navigation style. It uses the same building blocks as other apps: a name, a set of navigation items, and a utility bar if you add one. What changes is how the app opens records.
In a standard app, each item you open replaces the page you were on. You use the browser's back button or the navigation bar to return. In a console app, each item opens in its own tab inside the app. You can keep many records open at once and switch between them without losing your place.
Console apps suit people who handle many records in a short time, such as support agents working cases or sales reps working through a call list.
| Feature | Standard navigation | Console navigation |
|---|---|---|
| Opening a record | Replaces the current page | Opens in a workspace tab |
| Navigation items | Shown as tabs across the top | Shown in a dropdown menu |
| Open records | One at a time | Many at once, each in its own tab |
| Related records | Open as a new page | Open as subtabs under the parent |
| Keyboard shortcuts | Few | Many, for tab and utility control |
Where the navigation items go
In a standard app, the navigation bar shows your items as a row of tabs. In a console app, the bar shows the app name and a single dropdown menu. The dropdown lists the same navigation items, such as Accounts, Cases, and Reports. You pick an item from the menu, and its list view opens in a workspace tab.
The App Launcher still works the same way. You can switch between a console app and a standard app at any time. Your open tabs belong to the console app, so they appear again when you return to it. Salesforce can also restore them after a browser refresh in many cases.
Workspace tabs and subtabs
A console app has two levels of tabs.
- A workspace tab is a top-level tab. It holds a primary record or list view, such as a Case.
- A subtab opens under a workspace tab. It holds a record related to the primary one, such as a Contact on that Case.
The two levels let you group work by task. The Case stays open as the main tab, and everything you open from it stays beneath it.
How records open
Where a record opens depends on where you click it.
- Selecting an item from the navigation menu opens its list view in a workspace tab.
- Selecting a record from a list view opens it in a workspace tab.
- Selecting a record from a related list on an open record opens it as a subtab of that record.
- Selecting a record from global search opens it in a workspace tab.
If you open a record that is already open, the console switches to the existing tab instead of making a duplicate. This keeps the tab bar small.
Working with tabs
You can manage tabs in several ways:
- Select the X on a tab to close it. Closing a workspace tab closes its subtabs too.
- Right-click a tab to see actions such as Close Other Tabs, Pin Tab, and Refresh Tab.
- Drag tabs to reorder them.
- Use the overflow menu at the end of the tab bar when there are more tabs than fit on screen.
A pinned tab stays at the left of the tab bar, shows only an icon, and cannot be closed by accident. Pin tabs you return to all day, such as a list of your open cases.
Split view
Some console apps use split view, which you met earlier as a list view display mode. A split view shows a list of records on the left and the selected record on the right. Selecting another record in the list swaps the right panel without opening a new tab.
Split view is useful when you scan through many records quickly. You can still open a record in its own tab when you need to keep it. In an app that has split view enabled, the list pane can be collapsed to give the record more room.
The utility bar
Console apps often add a utility bar, a footer bar with small tools. Each utility opens a panel above the bar without leaving the current tab. Common utilities include:
- Recent Items, to jump back to records you opened.
- Notes, to write while you work on a record.
- History, to see recently viewed items.
- Open CTI or Omni-Channel, for phone and chat work.
Utility panels stay available as you switch between tabs. That is the main reason to use them: a note you start on one record remains open when you move to another.
Configuring a console app
An administrator sets up a console app in Setup under App Manager. The steps are:
- In Setup, enter App Manager in Quick Find and select it.
- Select New Lightning App, or edit an existing app.
- In App Options, set Navigation Style to Console navigation.
- Optionally set Setup Form Factor and Utility Bar options.
- Select the navigation items, and select the user profiles that can use the app.
- Save.
The navigation style is only available when you create or edit the app in App Manager. Changing it for an app that people already use changes their experience at once, so tell them before you switch it.
Console navigation and Lightning URLs
Opening a record in a console app does not change the address in the browser the way it does in a standard app. The URL usually points at the app and the first workspace tab, not at every open subtab. If you copy the URL and send it to someone, they land on the app's main view or the focused record, but they will not see your full set of open tabs.
The pattern you saw earlier still holds for the focused record:
/lightning/r/Case/500XXXXXXXXXXXXXXX/viewHere, 500XXXXXXXXXXXXXXX stands for a real Case record Id. To share a record with a colleague, copy that kind of URL instead of describing which tab to click.
Navigating tabs from code
A Lightning Web Component can use NavigationMixin in a console app just as in a standard app. When the app uses console navigation, the same Navigate call opens the record in a workspace tab. The call does not change.
To control tabs directly, such as opening a subtab or setting the tab label, use the lightning/platformWorkspaceApi module. It works only in console apps. Check that the app is a console app before you call it.
import { LightningElement, wire } from 'lwc';
import { IsConsoleNavigation, openTab, openSubtab, getFocusedTabInfo }
from 'lightning/platformWorkspaceApi';
export default class OpenRelatedTabs extends LightningElement {
@wire(IsConsoleNavigation) isConsole;
async openAccountTab(accountId) {
if (!this.isConsole.data) {
return;
}
await openTab({
recordId: accountId,
focus: true
});
}
async openContactSubtab(contactId) {
if (!this.isConsole.data) {
return;
}
const parent = await getFocusedTabInfo();
await openSubtab(parent.tabId, {
recordId: contactId,
focus: true
});
}
}The IsConsoleNavigation wire adapter reports whether the current app uses console navigation. Without that check, the tab calls fail in a standard app. Both openTab and openSubtab return promises, so use await or .then().
Common problems
- A record opens as a new page, not a tab. The user is in a standard app. Check the app name in the navigation bar and the navigation style in App Manager.
- A subtab opens as a workspace tab. The record was opened from a place that is not related to the current tab, such as global search. Open it from the related list instead.
- Tabs disappear after you switch apps. Tabs belong to one app. Switch back to the same console app to see them.
- Too many tabs slow the page down. Each open tab holds a record page in memory. Close tabs you no longer need, or use pinned tabs only for the few you use all day.
- A component works in one app but not in another. The code calls a console-only API without checking
IsConsoleNavigation.
Exercise
A support agent opens Case 00001 and then selects a Contact from the Case's related list. A second agent searches for the same Contact in global search. In a console app, where does the Contact open for each agent?
Show answer
For the first agent, the Contact opens as a subtab under the Case 00001 workspace tab, because it was opened from a related list on that record. For the second agent, the Contact opens in its own workspace tab, because global search results open as workspace tabs and are not tied to a parent record.
Exercise
Your LWC calls openSubtab and works in the Service Console but throws an error in the standard Sales app. What is the likely cause, and how do you fix it?
Show answer
openSubtab belongs to lightning/platformWorkspaceApi, which works only in apps that use console navigation. In the standard Sales app the call fails. Wire IsConsoleNavigation, check that its data is true before calling openSubtab, and fall back to NavigationMixin.Navigate when it is false.