Salesforce Fact #699 | Get current app details
How can we get the current app name in apex? we can query UserAppInfo and AppDefinition objects to get the details.
The below SOQLs are used to get the details:
UserAppInfo userAppInfo = [SELECT Id, AppDefinitionId FROM UserAppInfo WHERE UserId = :UserInfo.getUserId() ORDER BY LastModifiedDate DESC LIMIT 1];
AppDefinition appDefinition = [SELECT DurableId, Label FROM AppDefinition Where DurableId = :userAppInfo.AppDefinitionId LIMIT 1];
Reference: https://developer.salesforce.com/forums/?id=9062I000000IDhRQAW
Comments
Post a Comment