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
EchoEchoEchoEcho 

Updating Content Records "Without Sharing"

I have a Global class exposed as a webservice that is called by users who do not have the "Add Content" Workspace Permission, and am using "without sharing" to try to make it possible for that class to update fields on Content records. However, when I try to call the methods in this class, I receive insufficient access exceptions:

 

12:18:32.091|EXCEPTION_THROWN|[23]|System.DmlException: Update failed. First exception on row 0 with id 068M00000004G5HIAU; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []

 

If I try the same thing with a user that does have the "Add Content" workspace permission, everything works as expected. Is it possible to have a method run in the system context when updating content records?

 

Thanks,

Tom

Ron-LONRon-LON

I'm having this same problem.  Have you managed to get an answer on this?  Shame nobody else answered.

EchoEchoEchoEcho

Yeah, I got confirmation from Salesforce that Workspace/Content user permissions cannot be overridden by Apex. We ended up having to write information to a custom object, and then have a nightly batch that would go through and update the content records.