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
dmchengdmcheng 

User Email field unavailable to community users with sharing?


Is the Email field in the User object hidden from customer community users? My client has customer community and has written an application for the community. There is an Apex class "with sharing" that selects various fields from the User object. When a community user accesses this method, all field values are returned except for the Email field, which returns a null value.

When a standard license user performs the same function, the email value is returned.

Portal User Visibility and Community User Visibility is enabled. There is a sharing rule on the User object and all the community users are in the group.
Best Answer chosen by dmcheng
James LoghryJames Loghry
It's a User preference.  If a User goes to edit their contact information, they can choose whether or not to share their Title, Email, and other contact information with either employees, employees and external users, or the general public.  Here's a link that explains it all: https://help.salesforce.com/apex/HTViewHelpDoc?id=networks_contact_info_visibility.htm

Programmatically, you can set these preferences in Apex if need be:
 
User u = [Select ..];
u.UserPreferencesShowEmailToExternalUsers = true;
update u;



 

All Answers

AshlekhAshlekh
Hi,

According to new sharing rules now User object also support OWD. You need to check the all fields and record are shared with portal user.

-Thanks
Ashlekh Gera
dmchengdmcheng
Yes I have already set up User sharing rules.  All the User fields that I selected are accessible except for the Email field.
Stephen GillenStephen Gillen
Did you manage to solve this issue, I'm having the same problem users within the same community can't see each others email addresses but can see other details fine.
James LoghryJames Loghry
Stephen, did you happen to find anything?  I'm perplexed on this one too.  It's not a matter of field level security per se, because there's no Email field option for the User object in the profile settings.
James LoghryJames Loghry
It's a User preference.  If a User goes to edit their contact information, they can choose whether or not to share their Title, Email, and other contact information with either employees, employees and external users, or the general public.  Here's a link that explains it all: https://help.salesforce.com/apex/HTViewHelpDoc?id=networks_contact_info_visibility.htm

Programmatically, you can set these preferences in Apex if need be:
 
User u = [Select ..];
u.UserPreferencesShowEmailToExternalUsers = true;
update u;



 
This was selected as the best answer
dmchengdmcheng
Yes James, that was what we found too.
AaronGeorgeAaronGeorge
Hi!  Were you able to figure out this issue? I am running into a similar situation where community users are unable to see the Title field for other members of the community, even though UserPreferencesShowTitleToExternalUsers is set to true. However, the users are able to see the email field when UserPreferencesShowEmailToExternalUsers is set to true.