Created by Eric Smith
Here’s a new component that let’s you add a Quick App Switcher to your Record Pages or Utility Bars. Unlike the standard App Switcher, it is smart enough to take you to the same record or page you were on in the App you are switching away from.
In my org I have different Console and Regular Apps for different departments. In addition to that, I have different Record Types associated with some of those Apps. When trying to support my users or test different features, I often need to switch Apps. The standard App Switcher (much improved in Spring 20) still doesn’t take you to the same record or page you were viewing before you switched.
I decided to create my own Lightning Web Component where I could show my most used Apps and navigate to the same page or record I was on when I select the new App.
Because I wanted to have different selections available for different object record pages and to make it easier to implement, I made the component configurable with Custom Metadata.
Each configuration record lists the Apps to include, so all that is needed when you add the component to your page is the name of the Custom Metadata record and the background color you want for the component. I also used Component Visibility to only show the switcher on the page for System Administrators.
Here is the same component with a different configuration on my Case record pages.
I also wanted a way to implement the component not just on Record Pages but on the Utility Bar as well. Since LWC components are not aware of the record context on the Utility Bar, I wrapped the component in an Aura component so I could access the recordId.
Here is another sample configuration of the component, this time added to the Utility Bar for various Apps in my org.
When I create something like this, I like to keep it as generic as possible so that it can be configured and used by others to fit their own needs. To help with that (and to give myself a pretty good challenge), I created a Flow that you can run to create your individual Custom Metadata configuration records. To support this flow, I figured out how to create a LWC datatable component for Flow screens and an Apex component that can write and deploy Custom Metadata records.
Read the Instructions to learn how to install and configure this component.