+ Start a Discussion
Jawad Rehman01Jawad Rehman01 

Access to all user records of user object from with sharing class.

Hi,

I want to access the company name and smallphotourl fields from user object in with sharing class and i am not able to access these fields. I have granted access to user by using with sharing button but still not able to access the users. 

I need help that is there any way to access the users in with sharing class so that i access the desired fields from user object.
 
Jasveer SinghJasveer Singh
Hi Jawed Rehman 13

yes we can get, code is below check

public with sharing class WithShearing {
    public withshering(){
        list<user> u2=[SELECT CompanyName,SmallPhotoUrl FROM User ];
        System.debug(u2);
    }
}


Thanks & Regards
Jasveer Singh
 
Jawad Rehman01Jawad Rehman01
Hi Jasveer,

I have tried it and its also not working, and both the fields contains null values when i get it.