+ Start a Discussion
Rajat MahajanRajat Mahajan 

Urgently Required*** Help on Class



We have a requirement for an apex batch job :


1. Accounts object has a child object called (Purchase_Order__c) in a master detail relation

2. If we manually share accounts to a public group. the public group should have access to the PO also.

3. And if we remove that public group form the account we need to remove that sharing from PO too.


Could you help me with a sample code?





Since it's a master-detail relationship, the visibility should automatically be inherited. You just need to check your relationship field and see if "read" or "write" is required to modify child records. You can't actually directly share detail records, as CustomObject__Share will not be available.