Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a transaction that will occur only if a user is Active. Following is the way I tried

 User u = [select id,isActive from user where id=:userinfo.getuserid()];
          flag = false;

         ApexPages.addMessage(new ApexPages.message(ApexPages.severity.Error,'Error. User not Active.'));


Following is the error I get..

Error: Compile Error: Method does not exist or incorrect signature: User.IsActive()

share|improve this question
please clearly tell us what is problem you are facing? – AtulRajguru9 Jun 6 '14 at 5:20
I'm confused what's the real requirement here. If the user is inactive how he/she can log in? – highfive Jun 6 '14 at 5:23
m sorry i will update the question – MnZ Jun 6 '14 at 5:23
This doesn't make sense, the current user will always be active. – PepeFloyd Jun 6 '14 at 12:26
up vote 4 down vote accepted

In your code above isActive used as a method, but it's a filed in User object, try if ( !u.isActive) {

share|improve this answer
More to the point, the user is active, by definition, because they would not be allowed to execute the code if they were not. – sfdcfox Jun 6 '14 at 6:14
Thanks to both of you. Now I get this error Error: Compile Error: Method does not exist or incorrect signature: UserInfo() .. – MnZ Jun 6 '14 at 6:17
UserInfo is a standard class, not a method. – Pavel Slepiankou Jun 6 '14 at 6:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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