function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Leonard Silon 11Leonard Silon 11 

How do I conditionally share fields

Here are the variables
User A
User B
Account A
Account B
Address

User A can see Account A but not Account B
User B can see Account B but not Account A
User A and User B had read access to Address

We want to change sharing such that all users can see all Accounts. 
So User A can see both Account A & B
User B can see both Account A & B

But we want to make sure User A has access Address of Account A and not Account B 
and User B has access to Address on Account B but not Account A

I can do that with page layouts. However, when it comes to reports, both will be able to see the Address for both records if we share both records. How do I prevent that?
Gokula KrishnanGokula Krishnan
Hi Leonard,

You need go through with OWD, Role, Profile, Permission Set and Sharing Rules, In order to make the records visible(CRUD) access based on User.

For Example:
Once You make the Account as Private, then the record creted by User A con't see to User B, Similary, User B records is not visible to User A.

Reference : https://help.salesforce.com/articleView?id=security_sharing_owd_about.htm&type=5


Thanks,