You need to sign in to do that
Don't have an account?
Suresh Sampath
Current Appname in Lightning Experience
Hello,
I'm trying to determine the current app in Lightning mode. I tried both Javascript and Apex, but I was unable to get to retrieve the current appname.
In classic, I used the below which worked perfect!
document.getElementById("tsidLabel").innerText
This is not working in Lightning. We need page redirection based on the current application name. We tried in Apex too with "DescribeTabSetResult". But Apex retains the last application used or being used by the user and carries it over to Lightning. It ignores the user selection in Lightning and also the current displayed app in Lightning.
Any help in this regard would be greatly appreciated!!!
Thanks!!
I'm trying to determine the current app in Lightning mode. I tried both Javascript and Apex, but I was unable to get to retrieve the current appname.
In classic, I used the below which worked perfect!
document.getElementById("tsidLabel").innerText
This is not working in Lightning. We need page redirection based on the current application name. We tried in Apex too with "DescribeTabSetResult". But Apex retains the last application used or being used by the user and carries it over to Lightning. It ignores the user selection in Lightning and also the current displayed app in Lightning.
Any help in this regard would be greatly appreciated!!!
Thanks!!
Please try the below code, it may be helpful to you.
public static String getAppName() {
UserAppInfo userAppInfo = [SELECT Id, AppDefinitionId FROM UserAppInfo WHERE UserId = :UserInfo.getUserId() LIMIT 1];
AppDefinition appDefinition = [SELECT DurableId, Label FROM AppDefinition Where DurableId = :userAppInfo.AppDefinitionId LIMIT 1];
return appDefinition.Label;
}
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
All Answers
Please try the below code, it may be helpful to you.
public static String getAppName() {
UserAppInfo userAppInfo = [SELECT Id, AppDefinitionId FROM UserAppInfo WHERE UserId = :UserInfo.getUserId() LIMIT 1];
AppDefinition appDefinition = [SELECT DurableId, Label FROM AppDefinition Where DurableId = :userAppInfo.AppDefinitionId LIMIT 1];
return appDefinition.Label;
}
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
Thanks. This works and yes this was helpful.