Get App Identity

Use getCurrentApp() to discover the identity of the app that your code runs in. The SDK resolves the running app’s namespace, name, and an addressable qualified name, so you can scope requests and target features to the current app. For example, use the app identity in these cases:

  • Scope a call to your app, such as when you run a CMS search
  • Pass the qualified name of your app as an addressable app name

Import getCurrentApp from the @salesforce/platform-sdk package.

Resolves the identity of the running app.

ParameterTypeDescription
options?CurrentAppOptionsOptional configuration. Extends SDKOptions with a surface override.

getCurrentApp() resolves to a CurrentApp object. If you use getCurrentApp() outside of a web app or micro-frontend, such as in local development, CurrentApp is returned without the identity object.

Describes the running app. The identity object is present only when the runtime provides app identity. identity can be undefined, such as when it’s called in local development, or if appName is missing.

Describes the identity of the running app.

The AppIdentity interface has these properties.

PropertyTypeDescription
namespacestringThe app’s namespace, which defaults to c when the org doesn’t use a registered namespace.
appNamestringThe developer name of the UI bundle.
qualifiedNamestringThe addressable app name in the format namespace__appName, for example, MyNs__MyBundle.
bundleId?stringThe record ID of the UI bundle, provided by the runtime. Defaults to undefined in local development.

Check that identity is defined before you use it. If an app identity isn’t available, the SDK resolves to a CurrentApp without an identity object instead of throwing, so your app keeps rendering.

To use bundleId, read it with a fallback and validate it before you use it. bundleId defaults to undefined in local development.

Since getCurrentApp() never rejects, you don’t need a .catch() block. Handle the absence of identity in your code by checking that identity is defined, read bundleId with a fallback, and provide your default behavior when either is missing.

Resolve the app identity inside an effect, and guard the asynchronous result against a component that unmounts before the promise settles. It’s recommended to gate your logic on the value as identity can be undefined, such as in local development or when appName is missing.

Call getCurrentApp() where you need the identity. The SDK resolves the ambient app each time, so you don’t cache the result in an app context or provider.