Creating a rule

With the field in place, we can set up the rule which will define the sharing.

From the app launcher, open the FormulaShare app (if you don't see this, check that the permission set is assigned).

Rules are created from the FormulaShare Rules tab. Click "New Rule" to start setting one up.

Rule Detail View

The options below are set in this screen:

  1. Label, API Name and Description: Add something to distinguish this rule from others
  2. Object to Share: Select the object from the list of those available to share. Objects included are those which:
    • Support sharing - child objects in a master-detail relationship and some standard objects do not support independent sharing rules
    • Have an internal or external organisation-wide default sharing setting of either Private (for Read or Edit access levels) or Public Read Only (for Edit access level)
  3. Location of field with user, role or group: Objects can be shared based on values in fields on either the object itself (these rules are known as Standard Rules), or an object or custom metadata type related through a series of lookup or master-detail fields (these rules are called Cross-Object Rules). Limits apply to the total number of active rules of each kind
  4. Share With: The type of entity this rule should share with. Options for FormulaShare Lite are "Users", "Roles", "Roles and Internal Subordinates", "Roles, Internal and Portal Subordinates" (includes both community and portal users) and "Public Groups". FormulaShare Enterprise and Unlimited also include options to share with Manager Groups or users' Account or Opportunity Default Teams
  5. Specified in Field: The field which contains a reference to the user, role or group needing access. Fields which can be chosen are text fields, formula fields returning text and or lookups to the user object. The field selected should be populated with either the Salesforce 15 or 18 character id of the user role or group, or the role or group name (developer name) for sharing to work correctly
  6. Containing Type: Choose either "Id" or "Name" depending on which of these are populated in the field selected
  7. Access Level: Set to Read or Edit. For objects with an organisation-wide default sharing setting of Public Read Only, only the Edit option will be available
  8. Sharing Reason: Will be available for custom objects only. A unique sharing reason must be used for each rule on the same object. To set up a new reason, click the Manage Apex Sharing Reasons link below the field - clicking the refresh icon after setting this will show the reason to be selected

Clicking Save on this screen deploys details of the rule to be set up as custom metadata in the FormulaShare Rules custom metadata type. See the accessing and deploying rule metadata section for details of this.