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.
2 Answers
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;
After some additional digging and searching, I stumbled upon this article which answered my question
-
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 HeimMar 7, 2015 at 9:56