0

I am trying to determine whether the user is in Lightning Console when they select a Quick Action (Lightning Component) but it comes back as regular Lightning UI no matter if the user is on a Console layout or not. I'm using same technique described here: Can a lightning web component know the difference between console and standard view?

Note, unlike OP, my user is not in Service Console.

  • Can you add the minimla required code please to see what you are trying to do? – sanket kumar Aug 15 at 1:53
2

You can use isConsoleNavigation() for getting this information.

isConsoleNavigation()

Returns a Promise. Success resolves to true if console navigation is present, false otherwise. The Promise will be rejected on error.

Sample:

cmp:

<lightning:workspaceAPI aura:id="workspace" />
<lightning:button label="Is Console?" onclick="{! c.checkIfConsole }" />

JS:

checkIfConsole: function (component, event, helper) {
    var workspaceAPI = component.find("workspace");
    workspaceAPI.isConsoleNavigation()
    .then(function(infos){
        console.log("is Console? => ", JSON.stringify(infos));
    })
    .catch(err=>console.log("ERROR => ", err));
}
  • Thanks, just what I needed – snugsfbay Aug 15 at 17:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.