function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
charlie west 5charlie west 5 

Sharing Cases Through Junction Object

Hello, I am trying to share Cases between Accounts through a Junction Object called Permission_Access__c. On the object, I select the Account that is to be shared, the Account that is receiving the share, and select a check box to "Share Files". Once this is done, the user then can go to the Community Page for Cases, and see the shared Accounts on the page.
 
public with sharing class PermissionAccessHandler {
  public static void getPermAccessList(List<Permission_Access__c> triggerNew)
    {
   		List<Permission_Access__Share> permissionAccessList = new List<Permission_Access__Share>();
        List<CaseShare> caseShareList = new List<CaseShare>();
        
        if(Trigger.isAfter)
        {
			for(Permission_Access__c currRec : [SELECT Id, Account_That_Is_Sharing__c, Account_That_is_receiving__c from Permission_access__c Where Share_Cases__c = TRUE])
            {
                Permission_Access__Share pAShare = new Permission_Access__Share();
                pAShare.ParentId = currRec.Account_That_Is_Sharing__c;
                pAShare.UserOrGroupId = currRec.Account_That_Is_Receiving__c;
                pAShare.AccessLevel = 'Edit';
                pAShare.RowCause = Schema.CaseShare.RowCause.Manual;
                PermissionAccessList.add(pAShare);
            }
            
            Database.SaveResult[] lsr = Database.insert(PermissionAccessList, false);
I am using a handler + test classes which grant code coverage. However, the Cases are not showing up in the community. I see on AccountShare and CaseShare objects that there is the ability to grance AccessLevel, but I am told not to user Standard Objects for this kind of feature. What am I missing here? Thanks :D