I have a controller which I use to get all calls that were made against all Opportunities against an Account Object.

public with sharing class getOppCallsController {

private Id accountId;
public List<Task> oppCalls {get;set;}

public getOppCallsController (ApexPages.StandardController sc) {
    accountId = sc.getId();
    oppCalls = new List<Task>();

public Task[] getOppCalls() {
    if (accountId != null) {
        return oppCalls = [
                select Id, Subject
                from Task
                where WhatId in (select Id from Opportunity where AccountId = :accountId)
                and Type = 'Call'
    } else {
        return new Task[] {};


Now I want to create a Visualforce page which displays these calls.

Opportunity Name | Call Subject | Call Date (or similar to that)

I have written the following, just to do a bit of testing, because I am new to this, but I seem to already fail right in the beginning.

  <apex:page standardController="Account" extensions="getOppCallsController">
  <apex:repeat value="{!oppCalls.Subject}">

I get the error: Error: Unknown property 'VisualforceArrayList.Subject'

Not sure what to do next. Tia.


You will need to use Var attribute of repeater to access object elements ,here is how repeat tag is handled in VF

<apex:repeat value="{!oppCalls}" var="act">

While this is just demonstration but should help you to understand how an iteration of collection is done at front end in visualforce.Also your query will be on opportunity I believe and then from opportunity you want to access activity.

  • Hello, Unfortunately I tried that and I amended it to fit into my table, but it doesn't work. <apex:page standardController="Account" extensions="getOppCallsController"> <h1>Logged calls against opps</h1> <table> <apex:repeat value="{!oppCalls}" var="oc"> <tr> <td>This is the subject {!oc.Subject}</td> </tr> </apex:repeat> </table> </apex:page> – Lily Nov 13 '14 at 19:51
  • If your query returns rows there is no way this should fail .Check your query returns rows .Also you will need proper account id in url with id=AccountId – Mohith Shrivastava Nov 13 '14 at 20:07
  • how can I check whether my query returns rows? – Lily Nov 14 '14 at 14:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.