• Stephanie Stoddard
  • NEWBIE
  • 20 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
Hello, I have written an Apex Class Extension to override standard create contact for my visualforce page, and it works fine in the Sandbox environment.  I am having trouble deploying the class in my production environment - class code coverage is only at 63%.  I am not sure how to write a test to see where there is a code issue.  Here is my code:

public class ContactSaveExtension {

    ApexPages.StandardController controller;

    public ContactSaveExtension(ApexPages.StandardController controller) {
        this.controller = controller;
    }

    public PageReference saveAndRedirect() {
        controller.save();
        PageReference redirect = new PageReference('/apex/Thank_You');
        redirect.setRedirect(true);
        return redirect;
    }

}

Thank you for your help!
Stephanie
I have a VF page that creates a contact, but I want the form to redirect to a Thank You page rather than try to open the newly created contact in SF.  Here is my extension coding:

public class ContactSaveExtension {

    ApexPages.StandardController controller;

    public ContactSaveExtension(ApexPages.StandardController controller) {
        this.controller = controller;
    }

    public PageReference saveAndRedirect() {
        controller.save();
        PageReference redirect = new PageReference('ApexPage.Thank_You');
        redirect.setRedirect(true);
        return redirect;
    }

}

What am I missing?

Thank you!
Hello, I have written an Apex Class Extension to override standard create contact for my visualforce page, and it works fine in the Sandbox environment.  I am having trouble deploying the class in my production environment - class code coverage is only at 63%.  I am not sure how to write a test to see where there is a code issue.  Here is my code:

public class ContactSaveExtension {

    ApexPages.StandardController controller;

    public ContactSaveExtension(ApexPages.StandardController controller) {
        this.controller = controller;
    }

    public PageReference saveAndRedirect() {
        controller.save();
        PageReference redirect = new PageReference('/apex/Thank_You');
        redirect.setRedirect(true);
        return redirect;
    }

}

Thank you for your help!
Stephanie
I have a VF page that creates a contact, but I want the form to redirect to a Thank You page rather than try to open the newly created contact in SF.  Here is my extension coding:

public class ContactSaveExtension {

    ApexPages.StandardController controller;

    public ContactSaveExtension(ApexPages.StandardController controller) {
        this.controller = controller;
    }

    public PageReference saveAndRedirect() {
        controller.save();
        PageReference redirect = new PageReference('ApexPage.Thank_You');
        redirect.setRedirect(true);
        return redirect;
    }

}

What am I missing?

Thank you!