function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Surender reddy SalukutiSurender reddy Salukuti 

errorn pagereference

Hi everyone,
 i written this program using standard set controller

public class con_dele {
    public List<contact> contacts {set;get;}
    
    public con_dele(Apexpages.StandardSetController controller){
        List<string> fields = new List<string>{'firstname','lastname','phone'};
            controller.addFields(fields);
           contacts=(List<contact>)controller.getSelected();
        
    }
    public pagereference assiagn(){
        user u =[select id from user where alias='reddy'];
        for(contact c: contacts){
            c.ownerid=u.id;
        }
        update contacts;
        pagereference p = new pagereference('/003/o');//error in this line
        return p;
        
    }

}
Error -Constructor not defined: [pagereference].<Constructor>(String)


Thank you 
surender reddy
Khan AnasKhan Anas (Salesforce Developers) 
Hi Surender,

Greetings to you!

In your organization, you might have created a class named "pagereference". 

You need to rename your Apex Class to some other name. Or, you can use 'System' before PageReference. 
System.PageReference p = new System.PageReference('/003/o');

But, better to rename your class name.

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas