2

I have created a Contact Wizard to walk users through certain steps when creating a new contact. The issue I have now is that I need it to redirect to the first VF page in this wizard ONLY if they select one specific record type when they click to add a new contact. Though I've done redirects in VF pages, I'm not sure how to accomplish this from the Record Selection page. Any guidance would be greatly appreciated.

3

You will need to create a dispatcher Visualforce page. This page will read the record type id from the url string, and then redirect as appropriate. Make sure you don't select the "Skip Recordtype selection" checkbox. Then, when you select the New button, the record type select will render, the user will select their record type and then get redirected to your page. But, the Recordtype queryparameter will be included, and you can use the `String strRecTypeid = apexpages.currentpage().getparameters().get('RecordType');' to get the ID, then, based on the result, you can either redirect to your Wizard page or to the standard edit page setting your page reference like this:

PageReference conPage = new ApexPages.StandardController(Contact).edit();
    conPage.getParameters().put('nooverride', 1);
    conPage.setRedirect(true);
    return conPage;
-1

After some additional digging and searching, I stumbled upon this article which answered my question

http://blog.deliveredinnovation.com/2009/08/09/force-com-tip-new-button-override-to-assign-visualforce-page-to-specific-record-type-using-native-apex-code/

  • You should add a short excerpt of the linked information or conclusion into your answer since it improves readability and the link might break in the future, which would make your answer worthlessness. – Uwe Heim Mar 7 '15 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.