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
Salesforce P1Salesforce P1 

future method error 'INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []'

Hi All,

We have a future method that is called on the upload of files on a custom object. The objective of this method is to insert a record into 'ContentDistribution' object for every file. However, this method is erroring out with 'INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []' when triggered by a guest user action on the site.
We believe future methods are executed in the system context. In that case, this error doest make sense.  Is there anything we can adopt we pass through this error.
Sai PraveenSai Praveen (Salesforce Developers) 
Hi,

Can you confirm if the class is defined "With Sharing" or "with out sharing" in which this Future method is present?

Thanks.
 
Salesforce P1Salesforce P1
The parent class and class holding Future method are in the 'Without Sharing' context. Still, it is creating an issue for GUEST User.