I want to display a certain group of Events in Visualforce page - my query to only get Events that were created/modified after the Event happened - first tried with a custom field, but this proved unreliable to manage the field:
public class UsersEventsExt {
User U;
public UsersEventsExt(ApexPages.StandardController controller) {
U = (User) controller.getRecord();
}
public List<Event> getEvents() {
return [select subject, description, activitydate, Whatid, WhoId, comments_summary__c from Event where Ownerid = :UserInfo.getUserId() and Customfield__c = false];
}
}
I can get the events list by changing query to:
public List<Event> getEvents(datetime ActivityDatetime) {
return [select id, subject, description, activitydate, Whatid, WhoId, comments_summary__c from Event where Ownerid = :UserInfo.getUserId() and LastModifiedDate < :ActivityDatetime ];
}
But then my VF page fails. Here is what worked with the first query class:
<apex:page standardController="User" extensions="UsersEventsExt2">
<apex:pageBlock title="Meetings">
<apex:pageBlockTable value="{!Events}" var="c">
<apex:column headerValue="Click to Update"><apex:outputLink value="{!URLFOR($Action.Event.Edit,c.id)}" target="_blank">Update Meeting</apex:outputLink></apex:column>
<apex:column headerValue="Subject"><apex:outputLink value="{!URLFOR($Action.Event.View,c.id)}" target="_blank">{!c.subject}</apex:outputLink></apex:column>
<apex:column headerValue="Name" value="{!c.WhoId}"/>
<apex:column headerValue="Date" value="{!c.ActivityDate}"/>
<apex:column headerValue="Account" value="{!c.WhatId}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
The error lies in not getting Events from the query in the class I think? Though it looks like it does return them! any help appreciated! Thanks!