Programatic Sharing Flashcards
Which object do you use when you share a record using Apex?
Use the share object associated with the standard or custom object for which you want to share (Naming convention is the name of the object appended with __Share
Which object in a master-detail relationship do not have an associated sharing object?
The object on the detail side of a master-detail relationship. The detail record’s access is determined by the master’s sharing object and the relationship’s sharing setting
What are the 3 sharing types supported on a share object?
Managed sharing
User Managed Sharing
Apex Managed Sharing
Which users can add or change Apex managed sharing on a record?
Only users with “Modify All Data”
How do you go about creating Apex Managed Sharing for Customer Community Plus users?
Share objects aren’t available to Customer Community Plus users. Consider using a trigger, which operates with the without sharing keyword by default. Otherwise, use an inner class with the same keyword to enable the DML operation to run successfully. A separate utility class can also be used to enable this access
Is it possible to manually share a record to a user or a group using Apex or the SOAP API?
Yes, but if the owner of the record changes, the sharing is automatically deleted.
When the ownership of a record change, any manual shares will be remove. How can you prevent your programmatic shares from being removed as well
Use Apex Sharing Reasons for the row cause (instead of the ‘manual’ one)
What does the runAs method enforce?
A. User permissions
B. Field-Level Permissions
C. Record Sharing
C. Record Sharing
When /where can you use the runAs method?
Only in test methods.
Does the runAs method use up a user license?
The runAs method ignores user license limits. You can create new users with runAs even if your organization has no additional user licenses.