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
Brenna Monaghan 7Brenna Monaghan 7 

"Invalid cross reference key" error for RecordTypeId I can't find

Hi everyone!

We have a custom integration that is getting the following error:

[
{
"message": "Record Type ID: this ID value isn't valid for the user: 0123F000002c926QAA",
"errorCode": "INVALID_CROSS_REFERENCE_KEY",
"fields": [
"RecordTypeId"
]
}

I understand this may be about permissions, but the integration user for this integration is a Sys Admin. I also searched for the Id noted and can't find it in our Setup. I looked for other processes or workflows that may be doing something and it doesn't appear to be the problem. Any ideas?! thanks so much!

-Brenna
AnkaiahAnkaiah (Salesforce Developers) 
Hi Brenna,

Can you query the record types using below query in developer console, you can able to find the recordtype belongs which object and check the recordtype access for the respective user profile.
 
Select Id,name,sobjecttype From RecordType where id='0123F000002c926QAA'

If this helps, please mark it as best answer. 

Regards,
Ankaiah
 
Maharajan CMaharajan C
HI Brenna,

As Ankaiah mentioned you can query the record type id in that particular org...

In these kind of integration try to use the label or api name of record type... Avoid hard coding the ids in request... use the label or api name of record type the hadle it in apex... I hope your are consuming salesforce webservvice...

Id will vary between the different salesforce orgs... 

Thanks,
Maharajan.C
Brenna Monaghan 7Brenna Monaghan 7
Thank you both! I queried the record type and it came up with 0 records. I asked the dev working on the cusotm integration to search their codebase, but any other ideas about what this might be? Thanks!