Loading
Feature degradation | Gmail Email delivery failureRead More
Enhance Salesforce with Code
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Create Apex Sharing Reasons

          Create Apex Sharing Reasons

          When creating Apex managed sharing, create Apex sharing reasons for individual custom objects to indicate why sharing was implemented.

          Required Editions

          Available in: Salesforce Classic
          Available in: Professional, Enterprise, Performance, Unlimited, Developer, and Database.com Editions
          User Permissions Needed
          To create Apex sharing reasons: Author Apex
          To view Apex sharing reasons: View Setup and Configuration

          When creating Apex managed sharing, create Apex sharing reasons for individual custom objects to indicate why sharing was implemented, simplify the coding required to update and delete sharing records, and share a record multiple times with the same user or group using different Apex sharing reasons.

          Note
          Note For more information on Apex managed sharing, see the Apex Developer Guide.

          Salesforce displays Apex sharing reasons in the Reason column when viewing the sharing for a custom object record in the user interface. This allows users and administrators to understand the purpose of the sharing.

          When working with Apex sharing reasons, note the following:

          • Only users with the “Modify All Data” permission can add, edit, or delete sharing that uses an Apex sharing reason.
          • Deleting an Apex sharing reason will delete all sharing on the object that uses the reason.
          • You can create up to 10 Apex sharing reasons per custom object.
          • You can create Apex sharing reasons using the Metadata API.

          To create an Apex sharing reason:

          1. From the management settings for the custom object, click New in the Apex Sharing Reasons related list.
          2. Enter a label for the Apex sharing reason. The label displays in the Reason column when viewing the sharing for a record in the user interface. The label is also enabled for translation through the Translation Workbench.
          3. Enter a name for the Apex sharing reason. The name is used when referencing the reason in the API and Apex. This name can contain only underscores and alphanumeric characters, and must be unique in your org. It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores.
          4. Click Save.
           
          Loading
          Salesforce Help | Article