Lead Name ", "answerCount": 4, "upvoteCount": 0, "datePublished": "2015-06-23T03:38:10.000Z", "author": { "@type": "Person", "name": "Oldwen Adriano", "url": "https://trailblazers.salesforce.com/profileView?u=0053000000BNB8iAAH", "affiliation": { "@type": "Organization", "name": "--" } }, "suggestedAnswer": [ { "@type": "Answer", "text": "I hope you were able to get this resolved.   Please take a moment to mark the most helpful post as \"Best Answer\" to close off this string and help others in the community with similar questions.  Should you require additional help, please do not hesitate to ask.   Thank you all for your contribution to Success Community.", "upvoteCount": 0, "url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000A8gcxSAB", "datePublished": "2015-06-29T05:31:12.000Z", "author": { "@type": "Person", "name": "Pritam Shekhawat", "url": "https://trailblazers.salesforce.com/profileView?u=00530000009rpvmAAA", "affiliation": { "@type": "Organization", "name": "PwC South East Asia Consulting" } } } ] } } Skip to main content
I am attempting to create a VF page using a wrapper class, but I keep running into errors.  I have broken down my attempt to the most basic level to simply try to gain understanding.

 

Here is my class:

 

global class ControllerGetNext {

 

//Our collection of the class/wrapper objects Tasks

 

public List<tTask> taskList {get; set;}

 

//This method uses a simple SOQL query to return a List of Tasks

 

public List<tTask> getTasks()

 

{

 

if(taskList == null)

 

{

 

taskList = new List<tTask>();

 

for(Task t: [Select ID, Subject, ActivityDate, Due_Time__c, Description from Task])

 

{

 

// As each contact is processed we create a new Task object and add it to the taskList

 

taskList.add(t);

 

}

 

}

 

return taskList;

 

}

 

// This is our wrapper/container class. A container class is a class, a data structure, or an abstract data type whose instances are collections of other objects.

 

//In this example a wrapper class contains both the standard salesforce object Contact and a Boolean value

 

public class tTask

 

{

 

public Task tTask {get; set;}

 

//This is the contructor method. When we create a new tTask object we pass a Task that is set to the t property. We also set the selected value to false

 

public tTask(Task t) {

 

tTask = t;

 

}

 

}

 

}

 

//////////////////////////////////////////////////////////////////////////////

 

Here is my VF page

 

/////////////////////////////////////////////////////////////////////////////

 

<apex:page Controller="ControllerGetNext">

 

<apex:includeScript value="/support/console/28.0/integration.js"/>

 

<script src="/soap/ajax/28.0/connection.js" type="text/javascript"></script>

 

<script src="/soap/ajax/28.0/apex.js" type="text/javascript"></script>

 

<apex:form >

 

<apex:pageBlock >

 

<apex:PageBlockTable value="{!taskList}" var="t" id="pgBlockTable">

 

<apex:column >

 

<apex:facet name="header">Lead Name</apex:facet>

 

<apex:outputtext value="{!t.task.Subject}" />

 

</apex:column>

 

</apex:PageBlockTable>

 

</apex:pageBlock>

 

</apex:form>

 

</apex:page>
4 个回答
  1. 2015年6月29日 05:31
    I hope you were able to get this resolved.

     

    Please take a moment to mark the most helpful post as "Best Answer" to close off this string and help others in the community with similar questions.  Should you require additional help, please do not hesitate to ask.

     

    Thank you all for your contribution to Success Community.