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 by 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>



Reference:





No comments:

Post a Comment

Page-level ad