You need to sign in to do that
Don't have an account?
Galeeb SK
Sharing using Apex
Hi , i am try to share the records using ''apex sharing '' but sharing can't be possible .please guide me how to share the records using Apex with one Example
Thanks
Galeeb SK
Thanks
Galeeb SK
1) https://developer.salesforce.com/page/Using_Apex_Managed_Sharing_to_Create_Custom_Record_Sharing_Logic
2) https://help.salesforce.com/apex/HTViewHelpDoc?id=security_apex_sharing_reasons.htm
3) http://www.jitendrazaa.com/blog/salesforce/apex-based-sharing-in-salesforce/
4) http://blog.jeffdouglas.com/2009/11/25/programmatically-creating-sharing-rules-with-apex/
Example: On Opportunity, you want to give access to record to some users which are in related list.
One way is to manually share the record which will need the interference of opportunity owner. But everyone will love automated solution.
Apex managed sharing provides developers with the ability to support an application’s particular sharing requirements programmatically via Apex code.
Sharing Table
All objects that have a default sharing setting of the either “Private” or “Public Read Only” also have a related “Share” object that is similar to an access control list (ACL) found in other platforms. All share objects for custom objects are named as MyCustomObject__Share, where MyCustomObject__c is the name of the related custom object. A share object includes records supporting all three types of sharing: Force.com managed sharing, user managed sharing, and Apex managed sharing.
Please let us know if this will help you
Thanks
Amit Chaudhary
Apex Sharing :
Providing Sobject Access to targeted user by using Apex is called Apex Sharing.
By Default if OWD of the object is not set to most permissive access level(Public Read/Write) ,Then there will be automatically share object created for the existing object .
For Example if OWD for 'Account' is not set to Public Read/Write then 'AccountShare' object will be existing in the back-ground .
Please refer below post which can help you understand with simple real time scenioro
Apex Managed Sharing Explained with real time examples and use cases (https://salessforcehacks.blogspot.com/2020/01/apex-managed-sharing-with-real-time.html)