1

I'm trying to determine if lightning component is used in console or not and I tried to use this example https://developer.salesforce.com/docs/atlas.en-us.api_console.meta/api_console/sforce_api_console_lightning_isConsoleNavigation.htm

({
    isConsoleNavigation : function(component, event, helper) {
        var workspaceAPI = component.find("workspace");
        workspaceAPI.isConsoleNavigation().then(function(response) {
            console.log(response);
        })
        .catch(function(error) {
            console.log(error);
        });
    }
})

But I don't see anything in browser console, it skips or failing in promise but I don't see any error. I tried to use it in aura controller and helper and nothing works. <lightning:workspaceAPI aura:id="workspace" /> is added to component. What can be the issue?

  • Where do you call this method in your component? – tugce May 13 '19 at 15:12
  • @tugce callback on a button, a method is invoked, but isConsoleNavigation() is skipped – user2452483 May 13 '19 at 20:21
  • Can you share your component? I tested the sample and it works. – tugce May 14 '19 at 10:17
  • @tugce, I didn't mention that lightning component is embeded in visualforce page. And because of that workspace api not available from lightning. The only way I find is to use visualforce's workspace api by sending an event from lightning – user2452483 May 14 '19 at 12:23

Your Answer

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

Browse other questions tagged or ask your own question.