function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Can a Lightning Web Component know if it is in a Standard or Console App

I am trying to create a LWC that is aware of whether or not the App it is embedded in is uses Console or Stanadard navigation style.

I need this because I have two separate apps using the same component, one for fully licensed users and another for those only with Company Community.  

If console, I need to use Navigation.Mixin, for Standard, I just open a new window.

I've tried calling UserInfo.getUiThemeDisplayed() but I just get Theme4d returned regardless of which app I'm using.
Khan AnasKhan Anas (Salesforce Developers) 
Hi Scott,

Greetings to you!

Lightning Web Components doesn’t currently support Salesforce Console (Navigation Item API, Workspace API, UtilityBar API). To use a Lightning web component with Salesforce Console, wrap the component in an Aura component.

Please refer to the below link (check crmprogdev's answer) which might help you further.

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
Jason Snyder 3Jason Snyder 3
Scott, I had the same issue that you mentioned. No matter what theme I was in, the getUiThemeDisplayed() returned Theme4d. I ended up using this to get the NavType from AppDefinition:
public static String getNavType() { 
    UserAppInfo userAppInfo = [SELECT Id, AppDefinitionId FROM UserAppInfo WHERE UserId = :UserInfo.getUserId() LIMIT 1];
    AppDefinition appDefinition = [SELECT DurableId, NavType FROM AppDefinition Where DurableId = :userAppInfo.AppDefinitionId LIMIT 1];
    return appDefinition.NavType;

The NavType returns either "Standard" or "Console" Based on the application that the user is currently in. 

Here's a link to the Object Definition for AppDefinition:

Hope this helps.


Jason Snyder