2

I have a business requirement to show all records of a custom object to all users except for a small group called 'reviewers'. This requirement runs against the grain of standard SFDC sharing, so it's not straightforward to support.

One approach is to add all users except the reviewers to a public group Show and the reviewers to a public group Hide. The size of our org necessitates automating membership of Show.

It's easy to add members on user creation and deactivation by using a trigger on the User object. But I also need to remove users from Show if they are added to Hide. It does not appear possible to write a trigger on GroupMember to do this: Group and GroupMember do not appear in the SObject list when creating a new trigger in the developer console.

What would be other approaches to meeting this requirement?

3
  • is it okay to change the design. Means change custom object owd is private and then create a criteria based sharing rule. will it work?
    – S B
    Mar 3, 2017 at 12:24
  • I should have said that the starting point is that OWD for this custom object is Private. Sharing rules could then be used to widen visibility to a group of users which excludes the reviewers. My concern is that with thousands of users and only a handful of them being users, automation is the only way to make this approach work, and it's not clear whether I can automate public-group membership to move users between the Show and Hide groups as personnel changes occur. Mar 3, 2017 at 22:35
  • Just use a checkbox on user for "reviewer" and use visual workflow to add/remove user from groups when checkbox is checked / unchecked. Also I assume having a separaterole in the hierarchy for reviewers is out of the question? That would solve the issue with standard role based sharing.
    – gorav
    Mar 6, 2017 at 2:08

1 Answer 1

-1

The object names are actually CollaborationGroup and CollaborationGroupMember. You can create triggers on both.

3
  • CollaborationGroup represents a Chatter group (developer.salesforce.com/docs/atlas.en-us.api.meta/api/…). Public groups are Group objects where Type=Standard (developer.salesforce.com/docs/atlas.en-us.api.meta/api/…) Mar 3, 2017 at 22:32
  • 1
    Ah, so it is. I didn't catch that in the docs I read. You can definitely access it in Apex with Group and GroupMember. You could create a scheduled job that runs and cleans up the groups. It wouldn't be real time like a trigger but you could set it to run as frequently as every hour to clean up memberships. Mar 3, 2017 at 22:40
  • 1
    Useful to know - that would be frequent enough for our purposes. Thanks! The Group vs. CollaborationGroup thing caught me out once before; it's too easy to get confused over those two :>) Mar 3, 2017 at 22:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .