Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Salesforce
  3. Question
Salesforce

Apex Sharing of Case to All Internal Users

Asked by Benjamin Moore Jul 9, 2021 2.3K views 1 answer
Share

About this question

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

Your answer

1 Answer

More Salesforce discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Salesforce Blogs

Guides, tips and career advice on Salesforce from JanBask experts.