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

I am not able to display my DataTable Through controller

Hi ,


I have a controller through which i want to display all the fields in a page.My method "surveyform" is not working.I want to display all the fields value so that a user can input some value in it and save it.



<apex:page standardController="Case" extensions="Survey" sidebar="false">
 <apex:form style="background-color:#FFFFFF;"> 
    <style type="text/css">
        body {font-family:Arial Unicode MS;font-size:12px;}

 <apex:pageBlock title="Survey Form">
 <apex:pageBlockSection title="Please enter the details" collapsible="true"  columns="2" showHeader="true" 

  <apex:dataTable value="{!surveyform}" var="line"  width="50%">
 <apex:column >
 <apex:outputText value="Survey Name:" style="width:50px"/><br/>
 <apex:outputText value="How was the Case handling power:" style="width:50px"/><br/>
 <apex:outputText value="How was the feedback:" style="width:50px"/><br/>
 <apex:outputText value="Case:" style="width:50px"/><br/>
 <apex:column >
 <apex:inputField value="{!line.Name}"/><br/>
 <apex:inputField value="{!line.How_was_the_Case_handling_power__c}"/><br/>
 <apex:inputField value="{!line.How_was_the_feedback__c}"/><br/>
 <apex:outputField value="{!line.Case__c}"/><br/>

 <center><apex:commandButton value="Save" action="{!Survey}"/>
 <apex:commandButton value="Cancel" action="{!Cancel}"/> </center>




My Controller


public  class Survey {

  public List<Survey__c> sur{get;set;}
  public Id srid;
  public Case cs;
  public Id cid;
  public ApexPages.StandardController a;

     public Survey(ApexPages.StandardController
                                      stdController) {
       cs = (Case)stdController.getRecord();
       system.debug('menon:'+ cs);
       a = stdController;
       cid = a.getRecord().id;
       system.debug('Survey:'+ cid);
     public List<Survey__c> getSurveyform() {
         sur= [Select Name,How_was_the_Case_handling_power__c,How_was_the_feedback__c,Case__c from Survey__c where Case__c=:cid ];
         System.debug('sana:' + sur);
         return sur;
     Public PageReference Survey(){
     return null;



dotnet developedotnet develope

Hi Nasir,


I have check with your code, its working fine.


for confirmation, do you have any data associated with case and survey__c objects.




Yes i have data in case object.The flow is as follows.


Like when ever a case is created , we provide  solution for that case and then we close the case.A workflow is setup which send a mail whenever a case is closed.I had created a "Site" which contains that visual force page survey.A template is there with this site URL ,which is send in a mail through workflow.


When the user click this URL, that visual force page "survey" gets opened and then the user clicks save and this survey record should sit with that same case.


Above is the visual force page and the controller.


Here the problem is that i am not able to get the case record which is defined in the controller.I don't know why.


Here Case and Survey object is having master detail relationship.


and then by using "getsurvey" method i am trying to retrive the survey field in VF page through controller.If that i am not able to achieve.


Please help

Imran MohammedImran Mohammed

Can you tell what is the format of the URL you are sending via email?

Are the system.debug statements outputting a value when the page is visited clicking the link in email?



This is the format of the URL...( my fields is not getting populated.Just copy and paste this url .You will not be able to see any fields.


Here i am using case as a controller and i am using getmethod and calling "getSurvey" and i am using "Pageblocktable".


Is that a good approach?

Imran MohammedImran Mohammed

But the URL is not holding any record value of Case.

When the code gets executed, StandardController has no record in it to move further and thats the reason there is no data displayed.

Append the Case ID to the URL like URL/?id={!}