0

Background

I have 2 group of users having different roles and different profiles:

  • Sales Cloud users can only Read/Write Leads, Accounts, Contacts, Opportunities and should be able to view Service Cloud Users's Case only if under their own accounts
  • Service Cloud users can Read/Write Accounts & Cases

Existing Setup

  • OWD Settings for Account & Cases are PRIVATE
  • Sharing Based criteria rules setup to share Accounts Read/Write to Service Cloud Users
  • etc

What I tried

I need help with the bolded point above, I have tried to create a Sharing based criteria rule to share the Case.Account.Owner.Id access to those Sales Cloud Users so that they can view the case. However, you cannot use lookup fields or formula fields in Sharing based criteria rule.

How do I go about this? Invocable apex? Flow?

2 Answers 2

1

My initial approach to this was using (Visual) Flow, Record-Triggered Flow such that after a Case record is created or updated, it will Create a Case Sharing record as below :

Share Case record with Sales Cloud User

However I realised the easiest most maintainable way was via the standard settings in Role Hierarchy

Case Access = Users in this role can view all cases associated with accounts that they own, regardless of who owns the cases
1
  • 1
    note that the flow that creates the Case Sharing record would also have to remove the Case Sharing record if the Case's Account changes or is deleted. Your most maintainable solution is ideal and makes sense given the nature of the CRM application
    – cropredy
    Commented Jun 4, 2021 at 23:36
0

In my opinion, we can't use formula or lookup fields in the Criteria-based sharing rules because if the changes are done in the parent record then Salesforce will have to re-calculate all the child/grandchild/great-grandchild objects sharing rules, which will be really heavy-operation. So from the performance perspective, Salesforce is not allowing to use the lookup or formula fields in the criteria-based rules.

Option 1: You can create a normal field on the Case object whose value will be updated from the workflow or process builder. But in this case, if the owner of the Account is changed, then you will have to update the related case records so that the sharing will be re-calculated.

Option 2: You can write a trigger or flow to create and delete the Case sharing records based on the previous and current owner of the Case.

You must log in to answer this question.

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