Here is what I am trying to achieve, enter image description here Case OWD is Private.

I want to share cases created by community users with the community users(contacts) of the parent account of the associated account.Sharing sets are an all or nothing.

So I thought about apex sharing and started with writing a small snippet in developer console to test if it works for community users

CaseShare share = new CaseShare();
share.CaseId  = '5005B000002giXf';
share.UserOrGroupId = '0055B000000vZ7W';
share.CaseAccessLevel  = 'read';
insert share;

But this gave an error

Line: 5, Column: 1 System.DmlException: Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []

  • 2
    As you mention sharing sets I will assume you are using standard Customer Community licences which do not have access to Apex Sharing.
    – Dave Humm
    Commented Nov 6, 2017 at 15:42
  • @DaveHumm Thanks for your reply. Please update as an answer so I can accept it.
    – snehakem
    Commented Nov 9, 2017 at 11:34
  • added an answer. I have an idea for a solution but not been able to test it yet.
    – Dave Humm
    Commented Nov 9, 2017 at 14:21

1 Answer 1


The standard Customer Community and Customer Community Login licence types do not support Apex sharing, this means that it would not be possible to share to these users with this method.

I think that by creating a custom lookup field on Case to Account that is populated by a Process Builder with the Child Account Id could allow the use of a sharing set.

You must log in to answer this question.

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