My org has External Sharing Model enabled. It has Custom object with Default External Access set to Private.

enter image description here

Now I need that custom object to be shared with (read access) all users in specific profile.

Since the user is Customer Community Plus, I'm unable to set View All permission on object level. Sharing rule can't be use with a profile.

missing view all permission

How do i achive this requirement ?

  • I think you will need to look at Apex sharing for this. If nobody else puts up an answer I might be able to dig up an example of the code to do this.
    – Dave Humm
    Oct 9 '17 at 8:58

I could able to solve this by adding users into separate public group and share records using sharing rule.

Sample code for adding users dynamically to a public group can be found in here - Trigger to add active user with standard profile to public group


You can do this by having an Apex trigger to use Apex managed sharing as you are using Customer Community Plus users.

The documentation on this is here.

To sum up what you have to do is have an after trigger for insert and update of records on the custom object that will share to the users in that specific profile. It needs to be an after trigger so that the record Id is available to use in the sharing record as it will create a sharing record for each record in the custom object.

It may be best to add all the users with that profile to a group which the records are then shared to as this will be simpler than sharing to individual users.


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.