/
How does the Sharing Permission work

How does the Sharing Permission work

who (R1, GoldFinc) do what

Where (GoldFinch) (GF_ObjectTriggerHandler, GF_Object_SharingHelper)

(R1) (B2B_orderTriggerHandler, B2B_SharingHelper)

How

GF_ObjectTriggerHandler: GF_Object_SharingHelper.insertItemJournalSharingRecords

GF_Object_SharingHelper: (GFERP__Item_Journal__c itemJournal : itemJournalList) {
            if (pantryToAssociationMap.containsKey(whsePantryManagerIdMap.get(itemJournal.GFERP__To_Warehouse__c))) {
                for (B2B_PantryAssociation__c pa : pantryToAssociationMap.get(whsePantryManagerIdMap.get(itemJournal.GFERP__To_Warehouse__c))) {
                    GFERP__Item_Journal__Share itemJournalShare = new GFERP__Item_Journal__Share(
                            ParentId = itemJournal.Id,
                            UserOrGroupId = pa.Pantry_Manager__c,
                            AccessLevel = 'EDIT'

B2B_orderTriggerHandler: if(!pantryIds.isEmpty()){
                for(B2B_PantryAssociation__c pantryAssociation : [SELECT Id, Name, Pantry__c, Pantry_Manager__c FROM B2B_PantryAssociation__c 
                                                                            where Pantry__c IN: pantryIds]){
                    if(pantryAssociation.Pantry__c != null){
                        if(pantryAndPantryManagerMap.containsKey(pantryAssociation.Pantry__c)){
                            pantryAndPantryManagerMap.get(pantryAssociation.Pantry__c).add(pantryAssociation.Pantry_Manager__c);
                        }
                        else{
                            pantryAndPantryManagerMap.put(pantryAssociation.Pantry__c,new Set<String>{pantryAssociation.Pantry_Manager__c});
                        }

B2B_SharingHelper:

 if(pantryToAssociationMap.containsKey(bg.Pantry__c))
            {
                for(B2B_PantryAssociation__c pa:pantryToAssociationMap.get(bg.Pantry__c))
                {
                    BuyerGroupShare bgs=new BuyerGroupShare();
                    bgs.ParentId=bg.Id;
                    bgs.UserOrGroupId=pa.Pantry_Manager__c;
                    bgs.AccessLevel='READ';
                    bgShare.add(bgs);

When

 

Test results by Pantry Manager

Item Jornal

Transfer Journal

SKU disappeared?

did the R1 hourly routine overwrite sharing permission?

 

Possible to write an hourly routine to resync?????

 

Related content

GFERP Permission Sets
GFERP Permission Sets
More like this
Pantry Client Order Management
Pantry Client Order Management
More like this
Validation to Ensure Inventory can not be Moved between Owned and Consignment
Validation to Ensure Inventory can not be Moved between Owned and Consignment
More like this