Skip to main content
public PageReference save() {

                PageReference p = null;

                if (this.qp == null || !'yyyy'.equals(this.qp)) {

                    p = Page.failure;

                    p.getParameters().put('error', 'noParam');

              } else {

                    try {

                        Lead newlead = new Lead(LastName=this.lastName,

                                                FirstName=this.firstName;

                                                Company=this.company,

                                                Email=this.email)

                        insert newlead;

                    } catch (Exception e) {

                        p = Page.failure;

                        p.getParameters().put('error', 'noInsert');

                   }

                }

                 

                if (p == null) {

                    p = Page.success;

                }

                         p.setRedirect(true);

                return p;

            }
2 Antworten
  1. 3. Juli 2018, 06:59
    Hi Paul,

    Mark as best answer, If it resloves !!​

    this.qp == null || !'yyyy'.equals(this.qp)

    here you are making cretria to enter into loop, if satisfies above condtion getting error

    if it is not satisfing you are creating a new lead

    Lead newlead = new Lead(LastName = this.lastName,

        FirstName = this.firstName; Company = this.company,

        Email = this.email)

    insert newlead;

    then these is page refernce happing on 

    p = Page.success;

    }

    p.setRedirect(true);

    return p;

    Mark as resloved if it helps :) :)

    Thanks, 

    Bhanu Prakash

    visit ForceLearn.com (https://www.forcelearn.com/)
0/9000