0

I'm trying to insert Sharing records via apex for the object "SBQQ__Quote__Share". The class that inserts the record uses "without sharing", but when i to insert the record i receive the error:

Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []

This code works for other objects by the way..

i'm not adding the entire code as it is unnecessary, so here are the relevant parts:

public without sharing class OpportunityLookupsShareManager { 
public static void manageAccessToObject(sObjectType shareObject, sObjectType shareType,string oppFieldApiName, Map<String,Boolean> sharingMap) {
    Set<Id> opportunityIdSet = new Set<Id>(); 
    List<SObject> objectList = new List<SObject>();
    objectList = (List<SObject>)Type.forName('List<' + String.valueOf(shareObject) + '>').newInstance();
    List<SObject> sharedToInsertList = new List<SObject>();

    // ... Some logic here ...
        if (!sharedToInsertList.isEmpty()) {
            try {
                System.debug('sharedToInsertList: ' + sharedToInsertList);
                insert sharedToInsertList;
            } 
            catch  (DmlException ex) {
                system.debug(Logger.getException(ex));
                Trigger.New.get(0).addError(ex);
            }
        }
    }
}

}

in the debug logs i see:

sharedToInsertList: (SBQQ__Quote__Share:{AccessLevel=Edit, ParentId=a0x0Q0000002zwEQAQ, UserOrGroupId=00558000001ODmLAAW, RowCause=Manual})

Anyone knows what might cause the issue?

2 Answers 2

4

Dana Griff , This kind of error is basically coming due to sharing the inserted record back with the owner of the record who has full permissions on it already. for reference:

1) https://developer.salesforce.com/forums/?id=906F00000008z1JIAQ

2) https://help.salesforce.com/articleView?id=000206576&type=1

3) Why am i getting INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY error on code that worked before summer 13 update?

4) INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference

hope it help you.

1
  • i didnt even think about the option that the user already has sharing, thank you!!!
    – Dana Griff
    Mar 6, 2019 at 8:31
0

You are trying to insert/updating the data in SBQQ__Quote__Share object. it seems, user dont have permission to access this object. could you please confirm the user access? please check the profile

2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .