Timeline for How can I compare datetimes in a SOQL query to return a list to a Visualforce page?
Current License: CC BY-SA 3.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 7, 2014 at 16:48 | comment | added | dphil | You need to set the variable somewhere. Currently your ActivityDateTime is null. Or are you instead thinking of comparing the ActivityDateTime field within the query like you would with SQL? One thing to keep in mind is the differences between SOQL and SQL. If you wanted it similar to the SQL functionality then you should follow @Simon Lawrences example. | |
Feb 6, 2014 at 19:53 | comment | added | jaw999 | public class UsersEventsExt2 { User U; public UsersEventsExt2(ApexPages.StandardController controller) { U = (User) controller.getRecord(); } public DateTime ActivityDatetime{get; set;} public List<Event> getEvents() { return [select id, subject, description, activitydate, Whatid, WhoId, comments_summary__c from Event where Ownerid = :UserInfo.getUserId() and LastModifiedDate < :ActivityDatetime ]; } } | |
Feb 6, 2014 at 19:39 | comment | added | jaw999 | Hmm, I am missing a step - this query below returns all Events regardless of ActivityDateTime | |
Feb 6, 2014 at 18:58 | history | answered | dphil | CC BY-SA 3.0 |