+ Start a Discussion

Trouble with controller extension: Error: Unknown property 'ApexPages.StandardSetController.name'

Hi,  I have an object called Tasks__c and I am building an editable table for users to update the status of their tasks.  These are both my extension code and visualforce code.  I followed the guide to the word and cannot figure out why it is giving me an error:


<apex:page standardController="Tasks__c" recordSetVar="Tasks__c" extensions="TasksByUserID"
   tabstyle="My_Tasks__tab" sidebar="true">
   <apex:form > 
   <apex:pageBlock title="Hello {!$User.FirstName}!  Here are your tasks">
   <apex:pageMessages />
   <apex:pageBlockButtons >
      <apex:commandButton value="Save" action="{!save}"/>

   <apex:pageBlockTable value="{!taskRecords}" var="tsk">
      <apex:column value="{!tsk.name}"/>
      <apex:column value="{!tsk.Action_to_Perform__c}"/>      
      <apex:column value="{!tsk.AGN_Employee_Change__c}"/>
      <apex:column value="{!tsk.Application__c}"/>
      <apex:column value="{!tsk.Date_Due__c}"/>
      <apex:column headerValue="Current Status">
         <apex:inputField value="{!tsk.Current_Status__c}"/>



public with sharing class TasksByUserID {

    private final Tasks__c userTasks; 
    public TasksByUserID(ApexPages.StandardSetController controller) {

        this.userTasks = (Tasks__c)controller.getRecord();

        public ApexPages.StandardSetController taskRecords{
        get {
            if(taskRecords == null) {
                return new ApexPages.StandardSetController(
                [SELECT name, Action_to_Perform__c, AGN_Employee_Change__c, Application__c, Date_Due__c,
                Current_Status__c FROM Tasks__c where Assigned_To__c =:Userinfo.getUserId()]));
            return taskRecords;
        private set;
    public PageReference save() {
        return null;
    public List<Tasks__c> getTasks() {
         return (List<Tasks__c>) taskRecords.getRecords();


Best Answer chosen by Admin (Salesforce Developers) 

Try changing the table value to tasks instead of userTasks


<apex:pageBlockTable value="{!tasks}" var="tsk">

All Answers


StandardSetControllers are used to work on Lists, not a single instance of an object. Your userTasks member variable should be a list (List<Tasks__c>) and the in the contructor you should be using 

this.userTasks = (List<Tasks__c>)controller.getRecord();


Hi DaveH,


Thanks for helping out.  This does not solve my problem.  I still get the same error message when I change the userTasks to be List<Tasks__c> and the constructor to be 

this.userTasks = (List<Tasks__c>)controller.getRecords();


Any other ideas?






Try changing the table value to tasks instead of userTasks


<apex:pageBlockTable value="{!tasks}" var="tsk">
This was selected as the best answer

It worked.  Thanks!!!!!!