I want to share all the records of a custom object created by customer portal users with all the users of a particular profile. As of now, org-wide-setting of the object is private. Any thoughts?

3 Answers 3


Create a public group comprising of the Users you want to share to. Create a (ownership based) sharing rule, from Roles (Portal User Role) with the Public Group you've created as Read / ReadWrite.

  • 1
    Can I not share with profile only? What if a user is added later on then we have to add the user in public group explicitly to give access.
    – doga
    Nov 28, 2012 at 9:45
  • You cannot unfortunately share with users assigned to a Profile. If all the users you want to share with have the same role, you can share to that role. If not, you will unfortunately have to manage the public group. (There is always Apex Sharing) Nov 29, 2012 at 8:06

The sharing rules provided in the interface have two options; based on record owner or criteria.

Option 1: If you select based on record owner you can filter on Public Groups and Roles, which is what I would recommend trying out. If you can assign all of your portal users to a known set of Roles you could then create a new Public Group (My Name->Setup->Administration Setup->Manage Users->Public Groups) consisting of these Roles and then base your sharing rule on it.

Option 2: The other option, based on criteria, might work if you can take advantage of Record Types. If all of these objects created by your portal users have the same Record Type you could share them based on that.


I think there are two more custom options that will make automagically adding customer portal profile users to a public group a little easier rather than having to one-off add these users to the group:

  1. Create an apex trigger on user that evaluates the user's profile and if it's a targeted customer portal profile, automatically add the user to the customer portal public group member object. Conversely, if the user's profile is changed to a non-target customer portal profile, then remove them from the public group member object.

  2. Create an apex trigger on the target custom object that does a query on the record owner's profile and if it's the customer portal profile, automatically add a manual share using apex managed shares functionality. However, if the record ownership changes, this will delete all manual shares against the record.

You must log in to answer this question.

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