+ Start a Discussion

Variable does not exist on null check?

I have the following code in one of my classes:

if(adwc != null) {
       adwc.Used__c = true;
       adwc.Used_Time__c = datetime.now();
       update adwc;        


When trying to sace I just get the error "Variable does not exist: adwc" on the line with "update adwc;".


Any ideas why I get this error, the check is done to avoid this?



           Post your class code.so that we can have better idea about your error.