3

(NOT AN OPINION QUESTION, SO PLEASE DON'T CLOSE THIS)

With our security model, Product2 owners can't see Cases related through the Asset lookup. We want to let them see those Cases read-only. I can either

  1. Automate a CaseShare record, or
  2. Add them to the Case Team

It will be done in the Case trigger, doing the queries and finding the user, etc.

They won't be working the Case - just reporting on it - so I'm not sure that there's any real difference here except that they would either be shown in the Case Team related list or will have access that isn't noticeable in LEX because there's no sharing button.

To complicate it, the documentation says this: "If the owner of the record changes, the sharing is automatically deleted." So if our help desk changes the Case Owner, and share records are deleted, and I add them back, will that cause locking or other problems? I'd probably add my records in future context, but I wonder what would happen when the case owner changes.

In terms of performance, what is the better way to go? CaseShare or CaseTeamMember? Is there something I'm missing between the two options if the add is via a simple trigger method in both options.

1 Answer 1

2

As you've observed, the difference is if other users know that those users have had the case shared to them. Under the hood, the Case Team adds a Case Share anyways. There's no difference there. Since it's just reporting, I'd be tempted to say that just using a Case Share is sufficient.

6
  • Thanks. I also just saw this sentence: "If the owner of the record changes, the sharing is automatically deleted." So I'm not sure if I want to deal with order of events and the system deleting share records and then me adding them in a trigger... will probably be forced to go the team member route. It's a real conundrum. Commented Aug 26, 2020 at 17:34
  • @DavidSchach Team members, I think, may also be deleted on ownership change. I could be wrong, though, it's been a while since I've done this.
    – sfdcfox
    Commented Aug 26, 2020 at 18:05
  • @DavidSchach as far as I know, only "Manual" shared sharing records are deleted when record ownership changes. If you create an Apex Sharing Reason, CaseShare records with that Reason (RowCause) don't get automatically deleted when record ownership changes
    – Instread
    Commented Aug 26, 2020 at 19:25
  • See the "Creating User Managed Sharing Using Apex" section vs the "Creating Apex Managed Sharing" section here: developer.salesforce.com/docs/atlas.en-us.apexcode.meta/…
    – Instread
    Commented Aug 26, 2020 at 19:29
  • @Instread You're correct that "Apex managed sharing is maintained across record owner changes." But below that, it says "Apex sharing reasons and Apex managed sharing recalculation are only available for custom objects." And I'm looking at Cases, so I can't create a Reason/RowCause. So any shares I make will always be Manual. (developer.salesforce.com/docs/atlas.en-us.object_reference.meta/…) Commented Aug 27, 2020 at 18:08

You must log in to answer this question.

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