You need to sign in to do that
Don't have an account?
Mayank Deshpande 22
Getting Nullpointerexception while using standard set controller. kindly suggest whats wrong in code
Apex code
public with sharing class getopportunity {
public ApexPages.StandardSetController opty {
get {
if (opty==null)
{
ApexPages.StandardSetController opty = New ApexPages.StandardSetController (Database.getquerylocator([select Name, CloseDate FROM Opportunity])); }
return opty;}
set;}
public List<Opportunity> getOpportunities() {
return (List<Opportunity>) opty.getRecords();}
}
public with sharing class getopportunity {
public ApexPages.StandardSetController opty {
get {
if (opty==null)
{
ApexPages.StandardSetController opty = New ApexPages.StandardSetController (Database.getquerylocator([select Name, CloseDate FROM Opportunity])); }
return opty;}
set;}
public List<Opportunity> getOpportunities() {
return (List<Opportunity>) opty.getRecords();}
}
thanks
Remove "ApexPages.StandardSetController" from " ApexPages.StandardSetController opty = New ApexPages.StandardSetController (Database.getquerylocator([select Name, CloseDate FROM Opportunity]));"