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
AaronLauAaronLau 

Error "insufficient access rights on cross-reference id"

After I successfully uploaded Opportunity objects and their OpportunityLineItem objects, I failed to upload OpportunityLineItemSchedule objects. I got this error "insufficient access rights on cross-reference id
" I'm not sure why this happened, I am sure I have enough access rights to create new opportunities and add products on line in the salesforce.com.  Does anyone have any idea about why this happened?
benjasikbenjasik
Please provide more details. You may be trying to parent the Schedule to another record you don't have access to (that's what this error usually means)
AaronLauAaronLau

 Thank you very much for your reply.

My purpose is to extract all opportunities and line items from an xls file which is generated by another system, and then upload those opportunities and their lineitems to the salesforce.com through salesforce APIs.

I first get all opportunities and instantiate all those Opportunity objects, then I upload those objects. I succeed and can get generated opportunity IDs.

Second, I instantiate OpportunityLineItem objects that belong to the specific Opportunity object, and assign those line item objects the generated opportunity ID, and upload them, again, I succeed and can get all OpportunityLineItem IDs.

Third, after I succeed with uploading all OpportunityLineItem objects belong to all Opportunity objects, I begin to instantiate OpportunityLineItemSchedule objects, and assign them OpportunityLineItemId property, then I upload OpportunityLineItemSchedule objects belong to different opportunities respectively. I fail, and get the error "insufficient access rights on cross-reference id". I set relatively few properties to the OpportunityLineItemSchedule objects, following is my code snipet:

schedule.Description = description;
schedule.ScheduleDate = DateTime.Now.AddDays(1);
schedule.ScheduleDateSpecified = true;
schedule.Type = "Quantity";

schedule.OpportunityLineItemid = opportunity.Id;

Does this make sense?

AaronLauAaronLau

I made a mistake in the last post, the last line of code should be:

schedule.OpportunityLineItemId = lineItem.Id;

it is the Id of an OpportunityLineItem, not an Opportunity, that has been set to schedule.OpportunityLineItemId.

kimkim
Found following:

It says in the help that Profiles never overrides sharing rule or role hierarchy,
BUT modify all data does. This should be mentioned in the documentation.

Also when crossreferncing where the parent is owned by someone who's role is not set or where the role is outside the sharing of the user, wou will get this error.

Example: users that have left which still own a case, should still be taken into account of the hierarchy/ sharing.

Now question is...

Was this always the case or is this a change since API 8?


Benji, can you confirm this (or part of this)?

Kimberly Jansen


Mohammad AnzarMohammad Anzar
@AaronLau did you solve this issue. I am facing the exact same error. Couldn't figure out....
Suraj Tripathi 47Suraj Tripathi 47
Hi AaronLau,

It is an access issue of your Org, make sure you are provided the access.
just check it.

you can get help from this link :

https://help.salesforce.com/s/articleView?id=000328226&type=1 (https://help.salesforce.com/s/articleView?id=000328226&type=1)


If you find your Solution then mark this as the best answer.


Thank you!

Regards,
Suraj Tripathi