function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MaggieSumitMaggieSumit 

I have created a vf page and controller where I used action method, Now I want to display some data from controller but I am not able to retrieve.

Hi Members,
I have created a vf page and controller where I used action method, Now I want to display some data from controller but I am not able to retrieve. if I am creating constructor then Void method is not working.
Getting Error "Unknown property 'ControllerFeedback.obj'"
Below are the code: 
  1. <apex:page controller="ControllerFeedback">
  2.     <apex:form >
  3.      <apex:actionFunction name="doCallout" action="{!init}" rerender="none"/>   
  4.       </apex:form>
  5.     
  6.     <script>
  7.         window.onload=function()
  8.         {
  9.             doCallout();
  10.         }
  11.     </script> 
  12.     <p><center><b>You have Successfully update Opt Out.</b></center></p>  
  13.     <apex:outputPanel>
  14.         <apex:repeat value="{!obj}" var="a">
  15.              <p>{!a.Name}</p>
  16.         </apex:repeat>    
  17.     </apex:outputPanel>
  18. </apex:page>
 
  1. public class ControllerFeedback {
  2.     private final alu_Opportunity_Matching__c obj;
  3.     public void init() {
  4.         Id ids = ApexPages.currentPage().getParameters().get('id');    
  5.         system.debug('Id'+ids);
  6.         alu_Opportunity_Matching__c obj = [select id, Name,Application_Status__c FROM alu_Opportunity_Matching__c WHERE id = :ids];        
  7.         obj.Application_Status__c = 'Withdrawn';
  8.         Update obj; 
  9.         return;        
  10.     }
  11. }
Thanks
Sumit,
VamsiVamsi
Hi,

Can you just try the method name as below 

public void getinit() 
{
}
GulshanRajGulshanRaj
Hi Sumit,
1) To access in VF page your variable should be public:
public final alu_Opportunity_Matching__c obj;
2) <apex:repeat accepts iterable, so change it to list
public List<alu_Opportunity_Matching__> obj;
3) It should be accessible I changed it to getter setter property:
public List<alu_Opportunity_Matching__> obj {get; set;}

ControllerFeedback class code:
public class ControllerFeedback {
    public List<alu_Opportunity_Matching__> obj {get; set;}
    public void init() {
        Id ids = ApexPages.currentPage().getParameters().get('id');    
        system.debug('Id'+ids);
        alu_Opportunity_Matching__c obj = [select id, Name,Application_Status__c FROM alu_Opportunity_Matching__c WHERE id = :ids];        
        obj.Application_Status__c = 'Withdrawn';
        Update obj; 
        return;        
    }
}


Please compare your code and let me know if you have any question.

Thanks
Gulshan Raj