+ Start a Discussion

INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY on insert -opportunityineitem as customer portal usr

Hi Folks,
we created public site on a customer portal and while  inserting few opportunitylineitems for a newly created opportunity we are getting this error..

"Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []"

The steps are..

#1 Insert a opportunity..

#2 Insert Few opportunitylineitems on the basis of some buiseness logic for the opportunity created in step1

Sample code is something like this.
ContactId= CurrentLoggedUsersContactId ;
Opportunity Opp = new Opportunity(with all required details filled......);
insert  Opp;
OpportunityLineItem Oli = new  OpportunityLineItem (Contact__c = ContactId,UnitPrice=40.0,PricebookEntryId=01uT0000000pbcuIAA,OpportunityId= Opp.Id);

Insert Oli;//Error comes right at this line of code 
I check all the 3 Ids provided in insert call are valid.
This thing was working fine before the spring 10 release.

IS this because of the new release??

Please guide if any one knows or faced a similar problem.

Nikhil Jain

Having a similar problem with just adding a Note or Attachment from Sites eventhough it works as a Portal user.


Sounds like a bug to me especially if worked before Spring 10.   Can anyone confirm that this worked before Spring 10.


Maybe after  deleting the keywords:'with Sharing' ,it will be ok.


Most of the time, system context provides the correct behavior for system-level operations such as triggers and Web services that need access to all data in an organization. However, you can also specify that particular Apex classes should enforce the sharing rules that apply to the current user. (For more information on sharing rules, see the Salesforce.com online help.)