Pages

Tuesday, November 28, 2023

Salesforce: Reason for Access in Sharing

In an old blog written many years back, you can check the reason for access of a record to a user using the Sharing button. There is a slight difference in information given in Classic compared to Lightning.

Classic:
https://domain.my.salesforce.com/setup/own/entitywhylist.jsp?id=0060o00001TvlTM&uid=00590000000Ougm


Lightning:
https://domain.lightning.force.com/lightning/r/Opportunity/0060o00001TvlTMAAZ/recordShareHierarchy?userId=00590000000OugmAAC


Classic does not tell you which sharing rule, but only "Shared With". Lightning does better with the Rule Name, but in the above sample, the rule name is not very helpful "This_is_Test".


The Sharing Rule

Let's look at the sharing rule; for the below example, since there's only one sharing rule with "Shared With" to a specific group, we can identify the sharing rule quickly, but if there are many, we need to click edit to each rule to see the rule name. 



The rule name will only be visible when clicking the "Edit" link.



Is there an easy way to find the rule? 
Yes, you can download the metadata, e.g., using Salesforce Inspector or Workbench. 

    <sharingCriteriaRules>
        <fullName>This_is_Test</fullName>
        <accessLevel>Read</accessLevel>
        <label>This is Test</label>
        <sharedTo>
            <group>Group_Staff_2B</group>
        </sharedTo>
        <criteriaItems>
            <field>FieldName</field>
            <operation>notEqual</operation>
            <value>CH1,SG1</value>
        </criteriaItems>
        <includeRecordsOwnedByAll>true</includeRecordsOwnedByAll>
    </sharingCriteriaRules>


Sharing Rule by Criteria

Text and Text Area are case-sensitive. For example, a criteria-based sharing rule that specifies “Manager” in a text field doesn’t share records that have “manager” in the field. To create a rule with several common cases of a word, enter each value separated by a comma.

Example from below screenshot: Account Name containing AAA will be shared with Group Staff 1, but not for Account Name containing aaa



You can use the following field type for sharing by criteria:
  • Text
  • Text Area
  • Picklist
  • Checkbox
  • Number
  • Percent
  • Fax
  • Phone
  • URL
  • Date
  • Date/Time
  • Email

But, not the following field type:
  • Lookup
  • Formula
  • Currency
  • Long Text Area
  • Rich Text Area
  • Picklist (Multi-Select)
  • Roll-Up Summary



Reference:





No comments:

Post a Comment

Page-level ad