So I have a getter, setter and @AuraEnabled method. I know the way this was designed means that you can't have instance variables due to methods being static because of @AuraEnabled. My question is since I get an error message 'variables cannot be found', and my method is long, which is the best way to procede. I could use setParams and callbacks but I have a lot of variables. A lot of the functionality is in the apex method. Is there a better way?
@AuraEnabled
public static id accidc = Apexpages.currentPage().getParameters().get('id');
When I add static tag theres and error 'AuraEnabled fields cannot be static' however, if its not static then I cannot access the variable in my save method.
@AuraEnabled
public static void Save()
{ ...
CurrentLogdinUser =[SELECT name from User where id = :UserInfo.getUserId()].name; // --- error --- Variable does not exist
...
}
I will also try to add a wrapper for my variables.