We are using Apex sharing to share records owned by internal users with external partner users. We would like to have the OWD (Organization-Wide Default) for a custom object set to public read/write and external OWD for the same object set to private. We use Apex shares to extend access to select external users. The problem is that once we implement an Apex share on any custom object that has read/write access, any further changes to the OWD sharing results in the following error:

"Unable to change sharing model because sharing objects are referenced by the following components: <= list of classes referencing the Apex sharing reason =>".

If it wasn't for the fact that the OWD sharing for external users is different, this would make sense. I know the separate external sharing is relatively new, so perhaps this will be supported some time down the track. In the meantime, the workaround we are using is to define the internal sharing as public read only and then adding explicit sharing rules so that we effectively have the same as full read/write for internal users.

My question is, is there a better solution? Is there something I am missing? Perhaps there is a feature I should ask SF support to enable? An alternative might be to use text strings instead of the actual proper row cause references but that seems rather nasty and far from best practice.

  • By Apex Shares, do you mean that you are attempting to insert a specified list of external users to an objectshare table? – cricketlang Nov 11 '14 at 1:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.