0

Can we pass a getter value from apex to VF page in lightning aura enabled classes? I have a class which has a variable defined

public static Integer testvariable{get;set;}

now I have an auraenabled method which populates the value for this variable depending on certain condition but when I am trying to use this in my VF page it is showing as null

I tried the following ways to pass the values

1)By simply declaring the variable with get;set and in VF page {!testvariable}

2)By using a getter method

public Integer getChecktestvariable(){
        
        System.debug('when in Checktestvariable'+testvariable);
        return testvariable ;}

The debug log shows the method was not called at all please help

4
  • What is the reason to use AuraEnabled in VF? AuraEnabled is for LWC and Aura – Igor Vasylevskyi Nov 17 '20 at 10:01
  • one more time, where do you initialize testVariable? – ytiq Nov 17 '20 at 10:18
  • the testVariable is just delcared as shown and populated inside an AuraEnbled method – victor Nov 17 '20 at 10:39
  • 1
    This is an X-Y Problem. You should edit your question to include what you're actually trying to do, so we can help you better. This proposed solution presumably won't work, but without knowing what you're actually trying to do, it's hard to offer better advice. – sfdcfox Nov 17 '20 at 13:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.