0

Case comments have a "Public" checkbox allowing SF users to indicate if a comment should be made visible to the CP user.

I'd like to implement a similar design between two custom objects that are exposed in the portal: Parent__c and Child__c.

A Child__c record should be hidden from the customer portal if Child__c.Public__c is false.

Here are two solutions I've tried so far:

  1. Using a criteria-based sharing setting on Child__c is not possible if it's the detail side of a master-detail relationship.

  2. Even if it's not a master-detail, the sharing settings doesn't allow sharing to CP profiles.

Are there other ways of achieving this?

1

First you are correct that M-D relationship is out.

As for sharing rule, I'm looking at a sharing rule in an org I demo with where I have a criteria-based sharing rule that shares with the Public Group "All Customer Portal Users". So sharing with rules to Customer portal is an option, however, sharing rules do not support sharing to individual users currently. So this is more a limitation of sharing rules than Portal users.

Apex managed sharing is what you'll need to do. When you make the Child_c object Private, you will see a new object appear called Child_Share (that's two underscores). Apex managed sharing is simply the process of populating this object with records that indicate which Child__c record is shared with which User, Public Group, Role, or Role and Subordinate.

While you're at it, read the Sharing Architecture White Paper and the Record Access White Paper. These will help you better understand what is going on when you add or remove sharing to a record.

0

You'll need to use Apex Managed Sharing rules. This is done by creating a Sharing Reason on the Child__c object, then creating a trigger that provides sharing with the portal user(s) when the box is checked. Please take a look at Using Apex Managed Sharing to Create Custom Record Sharing Logic.

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.