I need to use a couple of variables in my lightning components. Hence, I declared them with @AuraEnabled
annotation. There are a couple of methods which also being used in a lightning controller(i.e. they are also with @AuraEnabled
annotation).
The variables which are annotated with @AuraEnabled
, will be updating in different conditions of methods. Hence I need to these variables in that @AuraEnabled
methods. However, I am getting compile time error, with following approaches:
- If I declare
@AuraEnabled
variables, and directly using them in@AuraEnabled
methods; I am getting variable not declared error.
e.g.
@AuraEnabled
public Integer someCount;
@AuraEnabled
public static List<custom_object> processData(){
if(this){
someCount += someValue;
}else{
someCount -= someValue;
}
}
- If I use
this.comeCount += someValue;
, I am getting Variable does not exist: this.sum1 error.
Please let me know if there is any way to achieve this or am I doing something wrong.