You need to sign in to do that
Don't have an account?
Andrea Voggenreiter 38
When I use navigationItemAPI.getSelectedNavigationItem().then(function(response) {})) then I get the error "Unable to find Lightning Console App", but only in the Sales Console
I have produced a lightning component and implemented it on the Case record page. Within the code I try to get the menu item via "getSelectedNavigationItem" similarly to how it is described in https://developer.salesforce.com/docs/atlas.en-us.api_console.meta/api_console/sforce_api_console_lightning_getSelectedNavigationItem.htm.
When I try it out in the Sales Console, this line still works:
var navigationItemAPI = component.find("navigationItemAPI");
but for this piece
navigationItemAPI.getSelectedNavigationItem().then(function(response) {
.catch(function(error) {
it does not log the response, but throws the error "Unable to find Lightning Console App".
However, it works fine within the Service Console.
What could be the reason for this behaviour?
When I try it out in the Sales Console, this line still works:
var navigationItemAPI = component.find("navigationItemAPI");
but for this piece
navigationItemAPI.getSelectedNavigationItem().then(function(response) {
console.log(response);
}).catch(function(error) {
console.log(error);
});it does not log the response, but throws the error "Unable to find Lightning Console App".
However, it works fine within the Service Console.
What could be the reason for this behaviour?
There are some limitations in the lighting experience, the below article explains it.
https://help.salesforce.com/articleView?id=console_lex_limitations.htm&type=5
For your reference,
https://success.salesforce.com/answers?id=9063A000000p6esQAA
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks.
thank you for your answer. I checked your links, and this is what I found:
1. both Sales and Service App are visible in the App Launcher
2. lightning:navigationItemAPI allows you to access methods for programmatically controlling navigation items in Lightning console apps, so it is not a Classic Console API; the method getSelectedNavigationItem() therefore is supported in Lightning. Furthermore, the code is working in the Lightning Service console, but not in the Lightning Sales console.
Would you have any further hints that might help?
Andrea