You need to sign in to do that
Don't have an account?
Andrew Hoban 6
Test Class for Page Redirect with record Type
HI there,
I have a controlller that navigates a user to a specific visualforce page depending on what record type they select.
Does anyone have any examples of what the test class should be?
Thanks
Controller:
I have a controlller that navigates a user to a specific visualforce page depending on what record type they select.
Does anyone have any examples of what the test class should be?
Thanks
Controller:
public class LeadNewController { public LeadNewController(ApexPages.StandardController controller) { this.controller = controller; } public PageReference getRedir() { PageReference newPage; if (ApexPages.currentPage().getParameters().get('RecordType') == '01230000000WIKN') { newPage = Page.PartnershipsLead; return newPage.setRedirect(true); } else if (ApexPages.currentPage().getParameters().get('RecordType') == '01230000000WIKS') { newPage = Page.CorporateSalesLead; return newPage.setRedirect(true); } else{ return null; } } private final ApexPages.StandardController controller; }
1) http://amitsalesforce.blogspot.com/search/label/Test%20Class
2) http://amitsalesforce.blogspot.com/2015/06/best-practice-for-test-classes-sample.html
please try below code.
Let us know if this will help you