I am querying for a particular user in my class(without sharing),it is returning null sometimes.User is available and he is the system administrator.
What might be the reason ? Am i missing anything ? Here is my Query [Select id from user where FirstName = 'Vipul' and lastname = 'Sama' and profile.name = 'System Administrator' limit 1].

Thanks very much.

  • Is it by any chance not returning anything, in test code ? Nov 29, 2012 at 10:57
  • I think if some users in the China access this functionality its returning null. Nov 29, 2012 at 11:09

1 Answer 1


I think it is because of translation from endlish to chinees. You should take better ID and not a hrdcoded Name.

Here is some info for you: Profile Name changes based on user language

  • But why the code is getting effected by the language change,it runs in system mode right ? Nov 29, 2012 at 11:15

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.