Newer Version Available
openSubtab() for Lightning Experience
Opens a subtab within a workspace tab. If the subtab is already open, the subtab is
focused. This method works only in
Lightning console apps.
Arguments
| Name | Type | Description |
|---|---|---|
| parentTabId | string | The ID of the workspace tab within which the new subtab opens. |
| pageReference | object | Specifies the pageReference to open. pageReference is optional. |
| recordId | ID | Specifies the record to open. recordId is optional. |
| url | string |
The URL representing the content of the new workspace tab. url is optional. The URL can be either relative or absolute. To use a third-party domain, add the site as a CSP Trusted Site. |
| focus | boolean | Specifies whether the new subtab has focus. To display the subtab immediately, set focus to true. To open the subtab in the background, set focus to false. |
Sample Code
This component has a button that, when pressed, opens a subtab within a workspace tab.
Component code:
Controller code:
Response
This method returns a promise that, upon success, resolves to the
ID of the new subtab.