I have code that inserts a ContentVersion (a File) that is run under a "Customer Community Login" license inside a Community/Experience. That works fine.
I now have an optional asynchronous layer that wraps that code in a Queueable that is started via a System.enqueueJob. This version fails with:
INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary.: [NetworkId]
At first I thought this Queueable apex invoked from triggers doesn't inherit sharing correctly might be the cause but changing the Queueable to be without sharing did not fix the problem as I hoped it might.
Any ideas anyone?
NetworkMemberon that scenario, but this still ugly, but the flip side is that you can avoid packaging multiple packages (at least not required any sort of global). – Jeferson Chaves Mar 09 '21 at 21:46