+ Start a Discussion
Jeanette Albert 15Jeanette Albert 15 

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

Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []
Error is in expression '{!genDoc2}' in component <apex:commandButton> in page doccontrolgather: Class.DocControlQuery.SavePDF: line 203, column 1
Class.DocControlQuery.genDoc2: line 120, column 1


I need help with this apex code.  I am not a coder :-S



 
Best Answer chosen by Jeanette Albert 15
Michael DsozaMichael Dsoza
YES, Can you please check with permission for the reference field & referenced object.
Thanks

All Answers

Michael DsozaMichael Dsoza
Hi Jeanette,

As per the error seems to me, you are setting value for any lookup or master relationship field & you dont have access for reference object.

Thanks.
Jeanette Albert 15Jeanette Albert 15
A user got this error. Sounds like they many need to have permissions added. Does that sound correct?
Thanks,
Jeanette
Michael DsozaMichael Dsoza
YES, Can you please check with permission for the reference field & referenced object.
Thanks
This was selected as the best answer
Jeanette Albert 15Jeanette Albert 15
Great. Thanks for your quick response.
NickCANickCA
For others looking for an answer to a similar problem that throws this error, I realized that when I was in my Sanbox environment, somehow some Lookup IDs from our Production instance had been copied over, but obviously you're not allowed to refer to something in Production from the Sandbox since there has to be a unique record in the Sandbox. 

That said, ensure that you're not using IDs for records from your Production instance anywhere in your process or that none of the Objects you're attempting to insert or update have any IDs that refer to or lookup something in your Production instance.