I have a number of
Contacts in the system, and a child object,
Company Profile, with a lookup to
Contact. This object has a picklist, "Area".
The idea is that each
Contact should be shared with as many "groups" of users as there are different Areas for each
Contact. So if Contact X has 3
Company Profiles with Area 1, Area 2 and Area 3 it should be shared with users from these three areas.
I have been analyzing how best to do this, and have a potential solution, but it's a bit of a kludge. I would like to know if there is a better approach since I am working with a clean slate here. Note that
Accounts aren't present in the system.
My potential approach:
ContactOrg-Wide Sharing to Private
- Add Users to different Public Groups, one for each
Areain the picklist.
- Create a trigger to copy the values to a new field Text Area(255)
ContactRecord. E.g. Contact X would have
Area1;Area2;Area3 from their Company Profiles.
- Create a
ContactSharing rule to check if this Text Area field CONTAINS Area1 and if so, share with the Area1 group. Repeat for all Areas.
- Although the number of Areas per Contact should be small, using a Text Area field (255) there could potentially be overflow. I can't use Long Text Area (32000) because they can't be used in Contact Sharing Rules.
- This approach seems fairly difficult to maintain, and unintuitive for the user.