Apex Sharing of Case to All Internal Users

930    Asked by BenjaminMoore in Salesforce , Asked on Jul 9, 2021

I am having an issue whereby I have created an Apex method to create a CaseShare record for a particular case. The manual share record provides Read access to the standard group "All Internal Users: based on the Record Type of the case. The sharing record gets created fine and is visible when I access the "Sharing" button on the record through Salesforce Classic. However, the problem arises when I try to log in with any other user to view this newly shared case in that the case does not appear. In order to check that it was not a permissions related issue I created a sharing rule to share any records created with the particular record type with the group All Internal Users and disabled my Apex Sharing rule and this worked just fine the case was created by Apex and the rule shared it out. I also tried to create the Apex sharing rule to share to a specific user and this also worked so cannot figure out why Apex sharing to 'All Internal Users' is not working. Here is how the Share record is being created

Group AllInternalUsers = [Select Id from Group where DeveloperName='AllInternalUsers']; Id AllInternalUsersId = AllInternalUsers.Id CaseShare cseShr = new CaseShare(); cseShr.CaseId = newCase.Id; cseShr.UserOrGroupId = AllInternalUsersId; cseShr.CaseAccessLevel = 'Read'; insert cseShr;

Is there something that I am missing when sharing case records to groups or anyone run into this issue before? The issue also seems to occur when I create a manual sharing record via the "Sharing" button in Classic to share to All Internal Users.

Thanks in Advance

Answered by Dipika Agarwal

 a custom group with All Internal Users added to it can be used although it is not the most elegant solution, it can work temporarily.



Your Answer

Interviews

Parent Categories