0

i have to retrieve list of Open Events in salesforce i am using following method for getting list of open Events

public List<OpenActivity> getActivity1(){

Meeting_Master__c mmm= [SELECT (SELECT Subject,Location__c,EndDateTime,StartDateTime
                           FROM OpenActivities Where IsTask = false )
                   FROM Meeting_Master__c where Id =:ApexPages.currentPage().getParameters().get('id')];
return mmm.openActivities;
}

ok i got the list but i need event's StartDateTime field but it is an invalid field for OpenActivity please specify how to get list of OpenEvents in which StartDateTime is also included??

mathlearner
  • 7,509
  • 31
  • 126
  • 189

1 Answers1

0

In this case you should use query to event object

 [SELECT Subject, 
         Location__c,
         EndDateTime,
         StartDateTime
 FROM Event 
 WHERE  WhatId =:ApexPages.currentPage().getParameters().get('id')];

Hope this may help you

Pavel Slepiankou
  • 3,516
  • 2
  • 25
  • 30
  • can u please specify what is difference between event and open Event – mathlearner Feb 13 '13 at 13:02
  • The openActivity is object which is represent the both instances: events & tasks and in this context we can't to query specific event's fields. Also we can query openActivities only on nested query for target object, e.g. Account. Event & Task is also represent as a different objects and can be queried via SOQL. – Pavel Slepiankou Feb 13 '13 at 13:13
  • then what is difference between openActivity and Activity?? – mathlearner Feb 13 '13 at 13:17
  • OpenActivity is read-only object which represents open tasks and events associated with an object. Regarding activity: In the user interface, task and Event records are collectively referred to as activities. – Pavel Slepiankou Feb 13 '13 at 13:26