I have those two methods inside my RSVP class :

 public LIST<News__c> getExcerpts() {
        String paramId = Apexpages.currentPage().getParameters().get('eventid');
        return [SELECT Title__C, Excerpt__c FROM News__c WHERE id = :paramId LIMIT 1];  
    public PageReference rsvpMe() {
        // QUERY EVENT
        try {
            List<News__c> eventList = [
                select Name,
                from News__c
                where Id = :paramId

            // EVENT NOT FOUND
            if (eventList.isEmpty()) {
                ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Warning, 'The event was not found.'));
                return null;

When I use the command button on my page the following error gets displayed "The event was not found") I cannot find anything wrong with this piece of code and cannot find an error in the methods. Anyone know how to make it work ?

here are the visualforce page code for the form that activates this method:

        <form role="form">
                <div class="form-group">
                    <label for="email">Confirm Email Address</label>
                    <apex:inputText styleClass="form-control" id="email" required="true" value="{!email}" />
                <apex:inputHidden id="eventid" value="{!eventid}" />
                    var jsEmail = "{!$Component.email}";
                    var jsEvent = "{!$Component.eventid}";
                document.getElementById(jsEmail).value = "{!$CurrentPage.parameters.email}";

  <apex:commandButton action="{!rsvpMe}" value="RSVP" id="rsvpButton" styleClass="btn btn-primary btn-lg btn-block" />

And here is the output that redirects them to the form page page:

 <apex:outputLink styleclass="btn btn-sm btn-default" onclick="ga('send', 'event', 'News_ReadMoreLatestNews', 'click', 'Read more news');" value="{!$Page.calypso_news}?id={!article.id}">Read More</apex:outputLink>
  • Your eventList array is empty. Maybe the paramId variable is null. Check out its content with System.debug(). Also, verify whether your current page contains a parameter named eventid and whether it's valid. Feb 1, 2016 at 13:45
  • The current page url is this: calypso_news?id=a0p7E0000005UPhQAM it doesnt let me get the debug for param id but the SOQL query seems fine to me. Can you see any errors ?
    – user26057
    Feb 1, 2016 at 13:56
  • The SOQL query is fine. It is just return nothing. Your returned list is empty. I see the param name is id and not eventid, so try this: Apexpages.currentPage().getParameters().get('id'); Feb 1, 2016 at 14:14
  • <apex:outputLink value="/calypso_RSVP?eventid={!article.id}" styleClass="btn btn-primary btn-sm btn-xs-block" id="register" rendered="{!IF(AND(article.Category__c == 'Events', ISBLANK(article.Custom_Registration_URL__c), article.Event_Date_End__c > NOW()), TRUE, FALSE)}">Register <i class="fa fa-arrow-circle-o-right"></i></apex:outputLink>
    – user26057
    Feb 1, 2016 at 14:24
  • thats the button for the redirect
    – user26057
    Feb 1, 2016 at 14:24

1 Answer 1


It looks like you're defining paramid only in the context of the getExcerpts method, in which case it's value won't be accessible to other methods.

You should define it as a public variable outside the method to allow it to be accessed from other methods.


Public string paramid { get; set; }

Then set its value in the getExcerpts method as you are already trying to but without "string" at the start.


paramid = ApexPages.CurrentPage() etc...

Also, how are you calling the getExcerpts method - as an Action on the page? Or from a constructor method? The paramid variable won't be populated until The getExcerpts method has been run...

You must log in to answer this question.