Why am i getting INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY error on code that worked before summer 13 update?

You seem to have a lot of hard coded Ids in your test method which isn't best practice in Salesforce Test Methods. Your issue could be because your test method cannot access data in your org or it could be a security issue.

I would suggest checking the following:

  1. Record Type Id specified is valid for your profile
  2. You have create permission on Case object
  3. You have read permission on Contact (specifically record '0033000000qYHOw')
  4. User '00530000003sMR5' is active
  5. Check your API Version is less than version 24.0. Later API versions will not give you access to org data by default. Consider creating records in the test method, or use annotation @isTest(SeeAllData=true) at the top of your test class.

(continuing from comments)

So there's a record type being set on your Case. Can you check your Profile (or Profile of the user in runAs if you use it in the test) for allowed Case record types and double check that the Rec type you use is available? If it's not available - yep, that's the error you'll be getting.

It's not a Spring'13-related thing, somebody had to recently modify your Profile (use Setup Audit Trail to track them and start shouting ;)).

(You can also temporarily comment out the line with rec. type setting and check if the test succesfully inserts. It might die somewhere later depending on your logic but by commenting the lookups out you should eventually nail it).


Although I have to say I don't recognize what object could be under 004 prefix. And this piece of code gives up (did you do some anonymisation?):

Id i = '0044000000qJTQr';
System.debug(i.getsobjecttype());

Tags:

Apex