Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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()];
     if(!u.isActive())
     {
          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 at 5:20
4  
I'm confused what's the real requirement here. If the user is inactive how he/she can log in? –  highfive Jun 6 at 5:23
    
m sorry i will update the question –  MnZ Jun 6 at 5:23
    
This doesn't make sense, the current user will always be active. –  PepeFloyd Jun 6 at 12:26

1 Answer 1

up vote 2 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
2  
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 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 at 6:17
    
UserInfo is a standard class, not a method. –  Pavel Jun 6 at 6:19

Your Answer

 
discard

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.