2

I've created a custom object to add an 'Attended' checkbox for invitees to an event. I've created a visualforce page list the events with a link to the attendance page where they can see a list of invitees and check a box to indicate that the invitee actually attended the event. The link from the events list page passes the event ID in the URL. I would like the invitees page to list all contacts (don't care about users or leads) and, ideally, allow the user to check the box directly from the list for each contact attending. If that's not possible, I don't mind having an Edit link for each invitee to check the Attended box.

I'm relatively new to SalesForce so I'm having trouble figuring out the best way to do this. I need to: 1. Add a button or a trigger to get the invitee list (and preferably the response status) from the Event Relation and Accepted Event standard objects to add records to the custom Event Attendance object with logic to prevent duplicating invitees for a particular event.

  1. Display the list of invitees for a particular event from the custom Event Attendance object with a way to change the response status and attended checkbox and save the record to the custom object.

Below is the code I've tried so far but the EventListController gives me errors:

List Events:

public with sharing class List_Events_Controller {

public List_Events_Controller(ApexPages.StandardController controller) {
    events = [SELECT ID, Subject, Description, ACTIVITYDATE FROM Event]; 
}

public List<Event>events {get; set;}

and

{!event.Subject}

This page works fine the invitee list is where I'm stuck:

public with sharing class InviteeListController {


    public InviteeListController(ApexPages.StandardController controller) {

      eventinvitees= [Select Id, OwnerId, IsDeleted, Name, CreatedDate, CreatedById, LastModifiedDate, LastModifiedById, SystemModstamp, LastActivityDate, LastViewedDate, LastReferencedDate, Status__c, Attended__c, Relation_id__c, EventID__c, Event__c FROM Event_Attendance__c WHERE EventID__c = '{!$CurrentPage.parameters.EventID}'];
    }


    public List<Event_Attendance__c>eventinvitees{get; set;}
}

and

<apex:page Controller="InviteeListController">
    <apex:sectionHeader title="Event Attendance" subtitle="List of Invitees"/>
    <apex:pageBlock title="Invitees">
        <apex:pageBlockTable value="{!eventinvitees}" var="eventinvitee">
            <apex:column value="{!eventinvitees.event_c}"/>
            <apex:column value="{!eventinvitees.attended}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>

with the following error: Error: Unknown constructor 'InviteeListController.InviteeListController()'

Any thoughts would be appreciated.

Thanks

1 Answer 1

1

I believe it is because you need to call this controller as a controller extension since your constructor is expecting a standard controller.

So on your page, try doing the following:

<apex:page standardController="Event_Attendance__c" extensions="InviteeListController">

If that is not what you want (since you don't seem to be using it), simply remove the standard controller in your controller's constructor parameter.

3
  • Thank you for the quick response. It guided me to a solution to the invitee list:
    – cahigg
    Commented Nov 13, 2014 at 18:45
  • <apex:page standardController="Event_Attendance__c" extensions="InviteeListController"> <apex:sectionHeader title="Event Attendance" subtitle="List of Invitees"/> <apex:pageBlock title="Invitees"> <apex:pageBlockTable value="{!eventinvitees}" var="eventinvitee"> <apex:column value="{!eventinvitee.Relation_id__c}"/> <apex:column value="{!eventinvitee.Status__c}"/> <apex:column value="{!eventinvitee.Attended__c}"/> </apex:pageBlockTable> </apex:pageBlock> </apex:page>
    – cahigg
    Commented Nov 13, 2014 at 18:45
  • I'm glad that helped! Commented Nov 13, 2014 at 18:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .