function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Tom Coffey 4Tom Coffey 4 

Deployment error: "invalid cross reference id" / How do I determine which Profiles are referenced in .app metadata files?

I’m attempting to migrate metadata from one org to another using a package.  But my deployment keeps failing with “Error  test/applications/Underwriting.app  Underwriting  invalid cross reference id”

Originally I was all three .app files in my metadata package were failing.  Then I did something (IDK what – I tried a bunch of stuff) that got two of the .app files to deploy and only one is failing now.

Looking at what changed in the .app files that failed but now deploy without error, I notice they no longer contain references to many standard profiles.  They only reference custom profiles and the Admin profile.  No other standard profiles besides Admin.

Also, if I look at the .app files that continues to cause problems, I see that it contains references to many if not all of the standard profiles.  As a result, I suspect it is the inclusion of these standard profiles that is causing problems.

I thought the fix would be easy: go to Setup > App Manager > App Settings > User Profiles, move the standard profiles from the Selected Profiles column to the Available profiles column and then update the package.

The problem is that it does not seem that changes I make to App Manager > App Settings > User Profiles are reflected in the .app metadata files in my package.

Removing standard profiles from the app with the .app file producing the error does not remove them from the .app metadata file.  Similarly, adding standard profiles to the apps whose .app files do not contain standard profiles does not add the selected standard profiles to these .app files.

This has left me perplexed.  Is the issue the standard profiles in the .app file?  If not App Manager > App Settings > User Profiles, how do I control which profiles appear in my .app files? 

Note: I’ve searched for similar errors / possible solutions.  The first link below sounds most similar but it’s marked as a “fixed” known issue as of a year ago so I don’t think that’s the issue.  The second link says there’s an invalid record ID in my code.  But the error messages I get identify the files producing the error and I’m 100% positive they do not contain any record (or other IDs).

https://success.salesforce.com/issues_view?id=a1p3A000000mCIdQAM&title=invalid-cross-reference-id-deploying-custom-app-with-profileactionoverrides-referencing-new-profiles-in-same-deployment (https://success.salesforce.com/issues_view?id=a1p3A000000mCIdQAM&title=invalid-cross-reference-id-deploying-custom-app-with-profileactionoverrides-referencing-new-profiles-in-same-deployment" style="color:blue; text-decoration:underline)

https://developer.salesforce.com/forums/?id=906F0000000BIhXIAW (https://developer.salesforce.com/forums/?id=906F0000000BIhXIAW" style="color:blue; text-decoration:underline)
 
Richard Wang 182Richard Wang 182
Hi Tom, 
It is a late reply but it may be helpful for people who may encounter the same issue in the future.
Root Cause: If the CustomApplication has "ProfileActionOverrides", it tries to get profileId from the target instance when deploying.
But if the profile is not available in the target SF instance, it will throw an "invalid cross reference id" error.

Solution: Any of the solutions would work.
1) Find the missing Profile in the target instance. Create the Profile before the deployment.
2) Remove the Profile related data block from CustomApplication Metadata File.
Note: "Call Centre' is the Profile Name.
 <profileActionOverrides>
        <actionName>View</actionName>
        <content>Call_Centre_Lead_Lightning_Record_Page</content>
        <formFactor>Large</formFactor>
        <pageOrSobjectType>Lead</pageOrSobjectType>
        <recordType>Lead.Referred_Lead</recordType>
        <type>Flexipage</type>
        <profile>Call Centre</profile>
    </profileActionOverrides>
2) Do not deploy CustomApplication. Add them in the target instance after deployment.

Cheers!
Richard
 
Gary WGary W
I'm also experiencing this issue. All of the profiles in my source org exist in my target org though, and they are also all included in the change set. I believe the issue in my case is due to this known issue: Special Characters like '+' when included in Name of a profile being deployed in an App can cause 'invalid cross-reference id' error (https://trailblazer.salesforce.com/issues_view?id=a1p3A000000mCnsQAE). We have a few profiles with + characters in them.

I have tried to manually remove the <profileActionOverrides> blocks which reference the affected profiles, from in the app metadata, however this isn't working as expected. When I deploy the modified metadata using SFDX, then retrieve the source form the org again, the changes have been reverted, and the removed blocks are again present with the problematic profile names.
hongbo yuhongbo yu
I also encountered the same problem.
Thanks to Richard Wang 182 for his answer.
As he said, the profile used in the Application does not exist in the resource or environment.
YANICK JAMESYANICK JAMES

(ITTCA)  IT TRAINING AND CERTIFICATION AGENCY

NO UFRONT PAYMENT!!

GET CERTIFIED. 
100%PASS GUARANTEED.

WhatsApp +1(409)223 7790
1. COMPTIA (network+ security+)

2: GMAT,GRE exams 

3: IAPP Certifications
(CIPP/E CIPM, CIPT)

4: ISACA certifications (CISA,CISM/ CRISC)

5: EC-COUNCIL Certification (CEH , CCISO )

6: PMI (PMP/CAPM/ACP/PBA ,RMP)

7: IMA (CMA certification)

8: CIA,IFRS, CERTIFICATIONS

9: ACCA,CFA,ICAEW certifications

10: ISO certification 

11 PASS CISSP EXAM 

12. APICS CERTIFICATIONS, CSCP, CPIM, CLTD

Book for online proctor exam and we’ll remotely take the exam for you. Pay us after confirmation of PASSED results 
ITTCA.org

WhatsApp +1(409)223 7790