You need to sign in to do that
Don't have an account?
Raoul Lake
List Type Error in Visualforce Controller Extension Training
Hi, am getting error message re Invalid Type in the Developer Console for an Apex class for a provided solution to a Visualforce Controller Training Course (exercise 3-4, Creating a Controller Using an Object Wrapper Class). Error is saying that "MyOutstandingReview" is an invalid type. Would appreciate direction on what I need to do to fix this error please.
The line throwing the error is (line 79 in the supplied code):
public List<MyOutstandingReview> myOutstandingReviews{
The fuller context for the exercise in the training is:
// TODO: Create a public list "myOutstandingReviews", which contains elements
// of type MyOutstandingReview. Override the getter.
// If null (on the first access), instantiate a new list.
// Iterate over the list of review__c records called "reviews" in a FOR loop.
// For each Review__c record, instantiate a new object
// of type MyOutstandingReview. Pass the iteration variable to the
// constructor. Add the new object to the list "MyOutstandingReviews".
// Always return the newly created list "MyOutstandingReviews"
// Use the default setter.
public List<MyOutstandingReview> myOutstandingReviews{
get{
// perform the logic to find the Reviews that have not yet been completed for the current Position
if (myOutstandingReviews == null) {
myOutstandingReviews = new List<MyOutstandingReview>();
for(Review__c review:reviews){
MyOutstandingReview record = new MyOutstandingReview(review);
myOutstandingReviews.add(record);
}
}
return myOutstandingReviews;
}
set;
}
Thank you.
The line throwing the error is (line 79 in the supplied code):
public List<MyOutstandingReview> myOutstandingReviews{
The fuller context for the exercise in the training is:
// TODO: Create a public list "myOutstandingReviews", which contains elements
// of type MyOutstandingReview. Override the getter.
// If null (on the first access), instantiate a new list.
// Iterate over the list of review__c records called "reviews" in a FOR loop.
// For each Review__c record, instantiate a new object
// of type MyOutstandingReview. Pass the iteration variable to the
// constructor. Add the new object to the list "MyOutstandingReviews".
// Always return the newly created list "MyOutstandingReviews"
// Use the default setter.
public List<MyOutstandingReview> myOutstandingReviews{
get{
// perform the logic to find the Reviews that have not yet been completed for the current Position
if (myOutstandingReviews == null) {
myOutstandingReviews = new List<MyOutstandingReview>();
for(Review__c review:reviews){
MyOutstandingReview record = new MyOutstandingReview(review);
myOutstandingReviews.add(record);
}
}
return myOutstandingReviews;
}
set;
}
Thank you.
Also, when you post any code, please use the code format (< >) button. Thanks.