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

Popular posts from this blog

Salesforce Fact #192 | Call batch apex from flow

Salesforce Fact #457 | Get current user role name in flow