+ Start a Discussion
Satya Ranjan MohantySatya Ranjan Mohanty 

If OWD is private for a object can we give access to that object through code i mean apex class or trigger.

Pradeep SinghPradeep Singh
Hi,
Yes you can share records using apex sharing. Please go through the below link.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_bulk_sharing_creating_with_apex.htm
Satya Ranjan MohantySatya Ranjan Mohanty
Hi Pradeep,

Thank you quick responce
can i give access to a paticuklar profile and role 

Regards,
satya
Pradeep SinghPradeep Singh
Yes you can do this, just create a public group and add roles and then use the id of the group for UserOrGroupId field.