• Jhogue
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies

Hi,

 

I am trying to get the list of  records from a custom object. I am having a input checkbox in the last column of the datatable. When anyone selects the checkbox, I am using a actionsupport component to send the Id of that record to the controller and perform. The id value is not passed to the controller. I am getting an error, Attempt to de-reference a null object.

 

The requirement is I have to display the sessions based on the dates. Users can register to the sessions by selecting the check boxes and click on register button. When they click register, he must be registered for all the selected sessions. 

 

Could anyone help me with this issue

 

Here is my Visualforce Page

 

 

<apex:page controller="sessionRegisterController">
<apex:form >
<apex:outputPanel >
<apex:selectRadio value="{!sessionDate}">
<apex:selectOptions value="{!SessionDates}" >
</apex:selectOptions>
<apex:actionSupport action="{!refreshsessionList}" event="onchange"/>
</apex:selectRadio>
</apex:outPutPanel>
<apex:outputPanel >
<apex:dataTable value="{!Sessions}" var="s">
<apex:column headerValue="Session Name" value="{!s.Session_Name__c}"/>
<apex:column headerValue="Presenters" value="{!s.Session_Name__c}"/>
<apex:column headerValue="Time" value="{!s.Session_Name__c}"/>
<apex:column headerValue="Location" value="{!s.Session_Name__c}"/>
<apex:column headerValue="Register">
<apex:inputCheckbox value="{!sessionChecked}">
<apex:inputHidden value="{!s.Id}"/>
<apex:actionSupport event="onclick" action="{!selectedSessions}">
<apex:param name="sessionId" value="{!s.Id}" assignTo="{!sessionId}"/>
</apex:actionSupport>
</apex:inputCheckbox>
</apex:column>
</apex:dataTable>
<apex:commandButton value="Register" action="{!Registration}"/>
</apex:outputPanel>
</apex:form>
</apex:page>

 

 

Here is my Controller

 

public with sharing class sessionRegisterController{

public String sessionDate{get;set;}
public Apexpages.StandardSetController con {get;set;}
public Boolean sessionChecked {get;set;}
public Id sessionId {get;set;}
public List<Id> selectedList {get;set;}

public sessionRegisterController(){
Sessions__c defaultDate = [select Id, Session_Date__c from Sessions__c order by Session_Date__c asc limit 1];
sessionDate = defaultDate.Session_Date__c;
refreshsessionList();
sessionChecked = false;
}

public void selectedSessions(){
if(sessionChecked==true)
selectedList.add(sessionId);
}


public List<SelectOption> getSessionDates(){
List<SelectOption> options = new List<SelectOption>();
List<Sessions__c> sessionList = [select Id, Session_Date__c from Sessions__c order by Session_Date__c asc];
Set<String> sessionSet = new Set<String>();
for(Sessions__c session: sessionList){
if(sessionSet.contains(session.Session_Date__c)){
}
else{
sessionSet.add(session.Session_Date__c);
options.add(new selectOption(session.Session_Date__c,session.Session_Date__c));
}
}
return options;
}

public void refreshsessionList(){
con = new ApexPages.StandardSetController(Database.getQueryLocator([Select Id,Session_Name__c, Presenters__c,Session_Time__c,Session_Location__c from Sessions__c where Session_Date__c=:sessionDate]));
con.setPageSize(10);
}

public void next(){
con.next();
}

public void previous(){
con.previous();
}

public Boolean getHasNext(){
return con.getHasNext();
}

public Boolean getHasPrevious(){
return con.getHasPrevious();
}

public List<Sessions__c> getSessions(){
return con.getRecords();
}

public PageReference Registration(){
User u = [select Id, Email,ContactId, CommunityNickName from User where id = :userinfo.getUserId()];
List<Sessions__c> registerList = [Select Id from Sessions__c where Id in :selectedList];
for(Sessions__c session : registerList){
Attendees_Registrations__c register = new Attendees_Registrations__c();
register.Sessions__c =session.Id;
register.Contact__c = u.ContactId;
register.AttendeeEmail__c = u.Email;
register.AttendeeEcas__c = u.CommunityNickname;
register.User__c = u.Id;
insert register;
}
return null;
}

}

Thanks, in advance

  • April 20, 2011
  • Like
  • 0

I can't install our package into our test org. Does anyone know how to handle this? I'd like to be able to fix it without wrangling too much with Support...

 

I have tried installing the package several times yesterday and today - and I have tried to isolate the problem within the objects. I know what object is causing the problem, but not what to do. The object has installed with no problem as a different version. (From the discussion boards, it looks like there is a known issue with installing apps in an org where they were installed (and removed) before - but no one says how to fix it in the org without Support.)

The error message I get is: "Your requested install failed. Please try this again. None of the data or setup information in your Salesforce organization should have been affected by this error. If this error persists, contact Support through your normal channels and reference number: 1525493615-16962 (717204977)"

 

I filed a customer support case: #02400539.