I have written a trigger on Case.I am querying user object to fetch user email id.I am getting the user id email value when checking the logs as Salesforce User but email id value is coming null when checking the log as partner community user...

List<User> UsList=[Select id,name,Email from user'];

This is the query.I am getting the Id and name when logged in as Partner community user but i am not getting email.Its been 2 days...I am only getting the logged in partner community email Id in my query..All the other user email ids are coming as null...

Is there any permission and something i need to mention in my query to get the email ids og other users....

Please help..

  • Is your class with sharing? – Mohith Shrivastava Mar 22 '14 at 7:29
  • Also whats the business use case that you are querying other users ? – Mohith Shrivastava Mar 22 '14 at 7:34
  • Actually this is a trigger...I have just put a user query in that trigger...I am trying to fetch user email id to send email notification but send email method is failing and says invalid email id (null) although there are correct email id values entered..While viewing the debug log as a community user the email id value is coming null but the values are retrieved successfully when viewing the log as Salesforce Users.. – miku Mar 22 '14 at 7:34
  • how are the other users linked to this community user?are they followers or something like that? – Mohith Shrivastava Mar 22 '14 at 7:48
  • They are Community Users..Earlier we used to have Partner/Customer Portal users..now We have Partner Community users..These are those...:) – miku Mar 22 '14 at 8:49

Partner community users are external users and they cannot access fields like owner.email and owner.phone. If you want to use email field of the user to send email notification you can create formula fields to fetch user email and use it in your email list.

Also do remember there is a limit of 10 cross reference


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.