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
gmcateer at gmailgmcateer at gmail 

invalid cross reference key when inserting into lookup object

This seems to be rights related, but I do not see which rights would resolve it.

I have a custom object 'test' that has 4 custom fields.

account__c     Lookup for Account
transDate__c  Date
amount__c      Currency
type__c           Text(20)

I am reading in data for this from an xml file. There may be 300 records I create at a time.
When I do an insert with this data on about 95% of the data I am getting the Invalid Cross Reference Key.

There are a few....less than 1% of Account IDs that do not match, or have been deleted.

I created a permission set which gave me rights to pretty much everything and applied it to my user. Still the same problem.

What am i missing?

Thanks!

Shiv ShankarShiv Shankar

This error appears when you try to put another reoced id in to particular lookup field for which it has been created.

 

For example you have creaed a lookup filed for Account, but in place of account id you are trying to put Contact Id.

 

gmcateer at gmailgmcateer at gmail
Thanks, however I validated the data coming in manually and they are
Account Ids. With the exception of the occasional deleted account.

This was one of my first thoughts...maybe I was getting contact Ids or
something else from the xml. But they are definitely account ids.

Thanks!