Skip to main content

I have complex requirement where I need to use Apex sharing for both standard & custom object. Share Object and its fields are different for Standard and Custom Obect. 

For example, 

for Lead, its share object is  LeadShare (fields: LeadAccessLevel, LeadId ...)

for Custom__c, its share object is Custom__Share (fields: AccessLevel, ParentId...)

 

Trying to make this dynamic in nature. and So  I need to find equivalent Share object for given object,  Is there any way to get this ?  Like using Schema or something else 

 

Thanks & Regards

5 answers
  1. Sumeet Negi (Eptura) Forum Ambassador
    Jun 26, 2024, 3:27 PM
    Hi @Piyush Lakhani

    So all the standard objects will have the name of their sharing object as the standard object api suffixed with the keyword share.

    Example- AccountShare, OpportunityShare

    All the custom object will always have the keyword share suffixed by the Share keyword.

    Example- CustomObject1__Share, CusObj__Share

0/9000