I have the following code which creates a CaseShare for a Partner Community User to share all cases across an Account. The UserOrGroupId is set to the Group of type 'RoleAndSubordinates' that is associated with the PartnerRole on the account using the 'RelatedId' field on Group.

CaseShare share = new CaseShare();
share.CaseAccessLevel = 'Read';
share.UserOrGroupId =  strgroupId;
share.CaseId = caseId;
share.RowCause = 'Manual';

The code runs succesfully and returns an Id of the CaseShare record but I can't view it in SOQL even as System Administrator. I tried omitting the RowCause and it makes no difference. Also the rule does not seem to grant the access intended.

  • what is the role of partner user? who is the owner of the record, how partner users are linked to all those Accounts? – Santanu Boral Aug 24 '17 at 18:23
  • All the Partner Users are community users created from the Contacts on each Account. For each Account they are automatically assigned a role generated that is unique to the Account so it should be possible to create CaseShare records for all users using the same UserOrGroupId. The Case owner will be the relevant customer service queue. – scottrm Aug 25 '17 at 10:37
  • Just to update tried running the same code through execute anonymous in developer console and it works but have these problems when it is in a trigger. – scottrm Aug 25 '17 at 12:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.