Skip to main content
Hi,

 

I have created two VF page, 2nd page containing Save and New button. After clicking these button user redirect to same page and record get saved. but I'm getting this error. Please help me in this.

 

Controller class:

 

public class CompanyController{

 

    public Company__c company{set;get;}

 

    public Employe__c employe{set;get;}

 

    public List<Company__c> com{set;get;}

 

    public id companyid{set; get;}

 

    ApexPages.StandardController controller=null;

 

    public CompanyController(ApexPages.StandardController sc){

 

 controller=sc;

 

    }

 

    public PageReference createEmploye(){

 

company=new Company__c();

 

      //c.Name=

 

     insert company;

 

   PageReference pr=new PageReference('/apex/EmployPage');

 

        pr.setRedirect(false);

 

        System.debug(pr);

 

        return pr;     

 

     

 

} 

 

   

 

    public PageReference doSaveAndNew(){

 

     Employe__c  employe=new Employe__c();

 

        employe.Company__c=company.Id;

 

        upsert employe;

 

      // employe.Company__c=company.Id;

 

       // insert employe;

 

         PageReference pr1=new PageReference('/apex/EmployPage');

 

                pr1.setRedirect(true);

 

                System.debug(pr1);

 

                return pr1;

 

}

 

}
1 respuesta
0/9000