You need to sign in to do that
Don't have an account?

Give access to record data even though the user doesn't have access to it
Hello,
In my test class, I want the user to be able to display contact data (name, phone, etc, which will be shown in a table), even for contacts to which he has no access. Of course, he wouldn't be able to access the page record (since he doesn't hava read permission.
However, when my query is run as the user, no contacts are shown.
Do you know a workaround ?
Thanks.
In my test class, I want the user to be able to display contact data (name, phone, etc, which will be shown in a table), even for contacts to which he has no access. Of course, he wouldn't be able to access the page record (since he doesn't hava read permission.
However, when my query is run as the user, no contacts are shown.
Select Id, Name, Phone from Contact;
Do you know a workaround ?
Thanks.
In fact, in my test class, I create a contact as user1. Then, I run my query as user2 using the runAs() method. However, my query returns an empty list.
That's because user2 cannot read or edit contacts created by user1. What I want to do is to be possible for user2 to see all contact fields (e.g. name, phone) without having access to the page record.