You need to sign in to do that
Don't have an account?
Mycodex
Display attendees for event
I'm trying to display a table of events and all associated attendees if it is a group event.
I can confirm with Apex Explorer that the SOQL statement is at least accurate and doesn't fail. Now my issue is displaying the attendees on the Visualforce page
I've tried !event.EventAttendees.AttendeeID (Error: Unknown property 'ArrayList.attendeeID') and !event.AttendeeID (Error: Invalid field attendeeID for SObject Event)
The EventAttendees object is not well documented and this might just be a complete failure from the start. Any help would be appreciated.
Code:
public List<Event> getEvents() { return [SELECT id, whatID, subject, startdatetime, whoID, accountID, (SELECT ID, AttendeeID, Status, RespondedDate, Response FROM EventAttendees) FROM Event WHERE whatID = :ApexPages.currentPage().getParameters().get('id') ORDER BY startdatetime DESC]; }
I can confirm with Apex Explorer that the SOQL statement is at least accurate and doesn't fail. Now my issue is displaying the attendees on the Visualforce page
Code:
<apex:PageBlock title="Events"> <apex:pageBlockTable value="{!events}" var="event" > <apex:column value="{!event.subject}"/> <apex:column value="{!event.startdatetime}"/> <apex:column value="{!event.whoID}"/> <apex:column value="{!event.accountID}"/> </apex:PageBlockTable> </apex:pageBlock>
I've tried !event.EventAttendees.AttendeeID (Error: Unknown property 'ArrayList.attendeeID') and !event.AttendeeID (Error: Invalid field attendeeID for SObject Event)
Use a nested datatable and set the value of it to "event.EventAttendees"
I get an empty list for EventAttendees even if i know they are there. will continue to look into it
Message Edited by Ron Hess on 01-09-2009 08:57 AM
No Ron, I have not tested it, but I assume it's supposed to work that way.
thanks
I don't think it can be done in one query, i believe you will have to develop an apex class that has all the logic to follow the initial query with a few more queries to get the various names you require using the attendee id's
this class can then return a list of wrapper objects with all the data as properties that the page can bind to.
Not sure if this is still relevant for whoever but the following worked for me:
<apex:DataTable value="{!event.EventAttendees}" var="attendee" > <apex:column value="{!attendee.attendee.name}"/> </apex:DataTable>