Apex Aide apexaide

Control Workspace Tabs & Subtabs using Platform Workspace API | Lightning Web Components #salesforce

www.salesforcebolt.com· ·Intermediate ·Developer ·4 min read
Summary

This content demonstrates how to use Salesforce's Platform Workspace API with Lightning Web Components to programmatically control tabs and subtabs in a Lightning console app. The example component covers opening new tabs and subtabs, changing tab labels and icons, highlighting tabs, navigating between tabs, and managing the ability to close tabs. It addresses the common need for developers to enhance user navigation and workspace customization in console apps, making the user interface more interactive and helpful. Salesforce teams can build similar components to improve user productivity by dynamically managing the workspace tabs and subtabs with efficient API calls.

Takeaways
  • Use openTab and openSubtab to create workspace tabs and subtabs programmatically.
  • Change tab labels and icons dynamically with setTabLabel and setTabIcon APIs.
  • Highlight tabs to draw user attention using setTabHighlighted method.
  • Navigate between tabs with getAllTabInfo and focusTab methods for better UX.
  • Control tab close functionality via disableTabClose to prevent accidental tab closure.

 Hi there, if you are looking for an example of Workspace APIs and planning to play around it than this blog post is for you. In this blog post I have created a lightning web component where we will be learning below features using Workspace APIs Open a new tab Open a subtab Change label of tab Set icon of tab Highlight a tab Navigate to next tab Navigate to previous tab Disable tab close Enable tab close A Lightning console app displays Salesforce pages as workspace tabs or subtabs. A workspace tab displays the main work item or record, such as an account. A subtab displays related records, such as an account’s contacts or opportunities. These methods work with workspace tabs and subtabs in Lightning console apps. Both Lightning Web Components (LWC) and Aura Components are supported unless otherwise specified. Checkout complete code of using workspace apis  WorkspaceAPIs.

Lightning Web Components[object Object]