Skip to main content
All CollectionsTroubleshootingSalesforce validation errorsSalesforce validation errors
Resolving validation errors - "invalid cross reference id" for Custom application metadata
Resolving validation errors - "invalid cross reference id" for Custom application metadata

Explanation and solution to this validation error "invalid cross reference id" surfaced during 'Custom application' metadata deployment

Quinn Kuiper avatar
Written by Quinn Kuiper
Updated over a week ago

Explanation of the error

This Salesforce error that Gearset is surfacing is usually encountered when deploying Custom application metadata.

When you try to deploy a Custom App with ProfileActionOverride that references newly created profiles, and you include both in a deployment package, it may results in the App component throwing the error: "invalid cross reference id".

What's the behaviour during the deployment?

When deploying, CustomApplication is normally saved before Profile. So when the CustomApplication is saved, the profileIds for the profiles which are newly added in the deployment, are not yet available.

If the CustomApplication has ProfileActionOverride, it tries to get profileId but since the profile is not available if it's new, the reference to the profileId becomes null resulting in the "invalid cross reference id" error.

As we understand, this is because of a dependency to a profile that is missing from your deployment and therefore the Custom application cannot be deployed.


To resolve this issue, you can try to include Profile metadata type in your metadata filter. Then selecting the dependent profile.

Salesforce proposed workaround

- Create the profiles referenced by the App's profileActionOverrides in the target org before deploying the App.
- Remove the App from the deployment, create it in the target environment and then deploy other components.

Further examples of this Salesforce validation error can be found here:

Salesforce Known Issues (updated 24 Feb 2023)

Trailblazer Community (May 2021)
Salesforce Help (updated 9 July 2021)

Disclaimer: This error is returned by Salesforce directly, rather than Gearset. Even so, we offer guidance based on our combined experience with the Metadata API. Where possible, we try to help guide you to fix or avoid this error. In the case that this isn't possible, we may need to direct you to Salesforce support for further clarification.

Did this answer your question?